GUIはとてもわかりやすくて便利ですが、
コマンドラインでサクッとやりたい時があります。
何度もプロジェクトファイルを呼び出したり、繰り返し処理をしたいときなどは便利です。
※前提としてGUIのDeeplabcutでラベル付けまでがされていること
(「Create training dataset」からコマンドラインで行う方法です)
・仮想環境にDeeplabcutがインストールされている場合は、あらかじめ仮想環境に入っておきます。
IPythonを起動する(Macならターミナル、Windowsならコマンドプロンプトから)
ipython
DeepLabCutを使用できるようにします
import deeplabcut
プロジェクトファイルの中のconfig.yamlとビデオファイルのパスを指定します
config_path = 'プロジェクトファイルの場所/config.yaml'
videos_path = 'プロジェクトファイルの場所/videos/m3v1mp4.mp4'
データセット作成「Create training dataset」
deeplabcut.create_training_dataset(config_path)
学習「Train network」
deeplabcut.train_network(config_path, shuffle=1, save_epochs=5, epochs=200, batch_size=8,)
評価「Evaluate network」
deeplabcut.evaluate_network(config_path, Shuffles=[1], plotting=True)
分析「Analyze videos」
deeplabcut.analyze_videos(config_path, videos_path, videotype='.mp4', auto_track=True, save_as_csv=True)
deeplabcut.plot_trajectories(config_path, videos_path,videotype='.mp4')
ビデオ作成「Create videos」
deeplabcut.create_labeled_video(config_path, videos_path)
ちなみに
プロジェクトの新規作成
deeplabcut.extract_frames(config_path, mode='automatic', algo='kmeans', userfeedback=False, crop=False)
ラベル付けのフレーム作成
deeplabcut.label_frames(config_path)
となってます。
コマンドの()内の指定方法は様々です