(see Stage XI and ‘Anticipated results’).
    """

    if "filterpredictions" in stages_to_run:
        deeplabcut.filterpredictions(config_path, videos_to_filter_predictions, videotype='avi', shuffle=1, trainingsetindex=0,
                                     filtertype='median', windowlength=5,
                                     p_bound=.001, ARdegree=3, MAdegree=1, alpha=.01,
                                     save_as_csv=True, destfolder=None)

    if "step_12" in stages_to_run or "plot_trajectories" in stages_to_run:
        deeplabcut.plot_trajectories(config_path, videos_to_plot_trajectories, videotype='.avi', shuffle=1,
                                     trainingsetindex=0, filtered=False, showfigures=False, destfolder=None)

    if "step_12_bis" in stages_to_run or "analyzeskeleton" in stages_to_run:
        deeplabcut.analyzeskeleton(config_path, videos_to_plot_trajectories, videotype='avi', shuffle=1,
                                   trainingsetindex=0,
                                   save_as_csv=True,
                                   destfolder=None)

    """
    In addition, the toolbox provides a function to create labeled videos based on the extracted poses by
    plotting the labels on top of the frame and creating a video. To use it to create multiple labeled
    videos (provided either as each video path or as a folder path), type the following:
    >> deeplabcut.create_labeled_video(config_path,[‘Full path of video 1’, ‘Full path of video 2’])
    This function has various parameters; in particular, the user can set the colormap, the
    dotsize, and the alphavalue of the labels in the config.yaml file, and can pass a variable called
    displayedbodyparts to select only a subset of parts to be plotted. The user can also save
    individual frames in a temp-directory by passing save_frames=True (this also creates a higher-
    quality video).
    """
    if "step_13" in stages_to_run or "create_labeled_video" in stages_to_run:
        deeplabcut.create_labeled_video(config_path, videos_to_create_with_labels, videotype='avi',
Esempio n. 2
0
DLC_config=deeplabcut.auxiliaryfunctions.read_plainconfig(posefile)
DLC_config['save_iters']=5
DLC_config['display_iters']=1
DLC_config['multi_step']=[[0.001,5]]

print("CHANGING training parameters to end quickly!")
deeplabcut.auxiliaryfunctions.write_config(posefile,DLC_config)

print("TRAIN")
deeplabcut.train_network(path_config_file)

print("Inference with new direct cropping")
deeplabcut.analyze_videos(path_config_file,[newvideo],destfolder=dfolder,cropping=[0,50,0,50],save_as_csv=True)

print("Extracting skeleton distances, filter and plot filtered output")
deeplabcut.analyzeskeleton(path_config_file, [newvideo], save_as_csv=True, destfolder=dfolder)
deeplabcut.filterpredictions(path_config_file,[newvideo])

#deeplabcut.create_labeled_video(path_config_file,[newvideo], destfolder=dfolder,filtered=True)
deeplabcut.create_labeled_video(path_config_file,[newvideo], destfolder=dfolder,displaycropped=True,filtered=True)

deeplabcut.plot_trajectories(path_config_file,[newvideo], destfolder=dfolder,filtered=True)


print("CREATING TRAININGSET for shuffle 2")
print("will be used for 3D testscript...")
deeplabcut.create_training_dataset(path_config_file,Shuffles=[2])

posefile=os.path.join(cfg['project_path'],'dlc-models/iteration-'+str(cfg['iteration'])+'/'+ cfg['Task'] + cfg['date'] + '-trainset' + str(int(cfg['TrainingFraction'][0] * 100)) + 'shuffle' + str(2),'train/pose_cfg.yaml')

DLC_config=deeplabcut.auxiliaryfunctions.read_plainconfig(posefile)
Esempio n. 3
0
    vname = Path(newvideo2).stem

    print("Inference with direct cropping")
    deeplabcut.analyze_videos(
        path_config_file,
        [newvideo2],
        save_as_csv=True,
        destfolder=DESTFOLDER,
        cropping=[0, 50, 0, 50],
        allow_growth=True,
        use_shelve=USE_SHELVE,
    )

    print("Extracting skeleton distances, filter and plot filtered output")
    deeplabcut.analyzeskeleton(path_config_file, [newvideo2],
                               save_as_csv=True,
                               destfolder=DESTFOLDER)
    deeplabcut.filterpredictions(path_config_file, [newvideo2])

    deeplabcut.create_labeled_video(
        path_config_file,
        [newvideo2],
        destfolder=DESTFOLDER,
        displaycropped=True,
        filtered=True,
    )

    print("Creating a Johansson video!")
    deeplabcut.create_labeled_video(path_config_file, [newvideo2],
                                    destfolder=DESTFOLDER,
                                    keypoints_only=True)