Skip to content

Commit

Permalink
DLC 2.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexEMG committed Jan 14, 2020
1 parent 3b7aa2c commit 8c6a766
Show file tree
Hide file tree
Showing 18 changed files with 385 additions and 103 deletions.
6 changes: 4 additions & 2 deletions deeplabcut/__main__.py
Expand Up @@ -10,8 +10,10 @@

import os

# if module is executed direcyly (i.e. `python -m deeplabcut.__init__`) launch straight into the GUI
if os.environ.get("DLClight", default=False) == False:
guistate=os.environ.get("DLClight", default="False")

# if module is executed directly (i.e. `python -m deeplabcut.__init__`) launch straight into the GUI
if guistate=="False": # or not guistate:
print("Starting GUI...")
import deeplabcut
deeplabcut.launch_dlc()
Expand Down
2 changes: 1 addition & 1 deletion deeplabcut/cli.py
Expand Up @@ -412,6 +412,6 @@ def plot_trajectories(_,*args,**kwargs):
--------\n
"""
from deeplabcut.utils import plotting
plotting.plot_trajectories(*args,**kwargs)
plotting.plot_trajectories(*args, **kwargs)

###########################################################################################################################
2 changes: 1 addition & 1 deletion deeplabcut/create_project/human_dataset.py
Expand Up @@ -139,5 +139,5 @@ def create_pretrained_human_project(project,experimenter,videos,working_director
deeplabcut.analyze_videos(cfg,[video_dir],videotype,save_as_csv=True)
if createlabeledvideo==True:
deeplabcut.create_labeled_video(cfg,[video_dir],videotype, draw_skeleton=True)
deeplabcut.plot_trajectories(cfg,[video_dir],videotype)
deeplabcut.plot_trajectories(cfg, [video_dir], videotype)
return cfg, path_train_config
1 change: 1 addition & 0 deletions deeplabcut/gui/__init__.py
Expand Up @@ -21,3 +21,4 @@
from deeplabcut.gui.train_network import *
from deeplabcut.gui.welcome import *
from deeplabcut.gui.media import *
from deeplabcut.gui.create_videos import *
34 changes: 30 additions & 4 deletions deeplabcut/gui/analyze_videos.py
Expand Up @@ -12,6 +12,7 @@
import wx
import os,sys,pydoc
import deeplabcut
from deeplabcut.utils import auxiliaryfunctions
media_path = os.path.join(deeplabcut.__path__[0], 'gui' , 'media')
logo = os.path.join(media_path,'logo.png')

Expand All @@ -24,6 +25,7 @@ def __init__(self, parent,gui_size,cfg):
wx.Panel.__init__(self, parent=parent)
# variable initilization
self.filelist = []
self.bodyparts = []
self.config = cfg
self.draw = False
# design the panel
Expand All @@ -45,7 +47,7 @@ def __init__(self, parent,gui_size,cfg):
self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="*.yaml")
else:
self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
# self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")

self.sizer.Add(self.sel_config, pos=(2, 1),span=(1,3),flag=wx.TOP|wx.EXPAND, border=5)
self.sel_config.SetPath(self.config)
self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config)
Expand Down Expand Up @@ -116,9 +118,17 @@ def __init__(self, parent,gui_size,cfg):
self.filter.SetSelection(1)

self.trajectory = wx.RadioBox(self, label='Want to plot the trajectories?', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
self.trajectory.Bind(wx.EVT_RADIOBOX,self.chooseOption)
self.trajectory.SetSelection(1)

self.create_labeled_videos = wx.RadioBox(self, label='Want to create labeled video(s)?', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
config_file = auxiliaryfunctions.read_config(self.config)
bodyparts = config_file['bodyparts']
self.trajectory_to_plot = wx.CheckListBox(self, choices=bodyparts, style=0,name = "Select the bodyparts")
self.trajectory_to_plot.Bind(wx.EVT_CHECKLISTBOX,self.getbp)
self.trajectory_to_plot.SetCheckedItems(range(len(bodyparts)))
self.trajectory_to_plot.Hide()

self.create_labeled_videos = wx.RadioBox(self, label='Create labeled video(s)? (see next tab for more options)', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
self.create_labeled_videos.Bind(wx.EVT_RADIOBOX, self.choose_create_labeled_video_options)
self.create_labeled_videos.SetSelection(1)

Expand All @@ -137,6 +147,7 @@ def __init__(self, parent,gui_size,cfg):
hbox2.Add(self.csv,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
hbox2.Add(self.filter,10,wx.EXPAND|wx.TOP|wx.BOTTOM,5)
hbox2.Add(self.trajectory,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
hbox2.Add(self.trajectory_to_plot,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
boxsizer.Add(hbox2,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

hbox3.Add(self.cropping,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
Expand Down Expand Up @@ -261,8 +272,8 @@ def analyze_videos(self,event):
deeplabcut.create_labeled_video(self.config,self.filelist,self.videotype.GetValue(),shuffle=shuffle, trainingsetindex=trainingsetindex, draw_skeleton= self.draw,trailpoints = self.trail_points.GetValue(), filtered=True)

if self.trajectory.GetStringSelection() == "Yes":
deeplabcut.plot_trajectories(self.config, self.filelist, videotype=self.videotype.GetValue(), shuffle=shuffle, trainingsetindex=trainingsetindex, filtered=True, showfigures=False, destfolder=self.destfolder)

deeplabcut.plot_trajectories(self.config, self.filelist, displayedbodyparts=self.bodyparts,
videotype=self.videotype.GetValue(), shuffle=shuffle, trainingsetindex=trainingsetindex, filtered=True, showfigures=False, destfolder=self.destfolder)

def reset_analyze_videos(self,event):
"""
Expand Down Expand Up @@ -290,3 +301,18 @@ def reset_analyze_videos(self,event):
self.trail_points.Hide()
self.SetSizer(self.sizer)
self.sizer.Fit(self)

def chooseOption(self,event):
if self.trajectory.GetStringSelection() == 'Yes':
self.trajectory_to_plot.Show()
self.getbp(event)
self.SetSizer(self.sizer)
self.sizer.Fit(self) #this sets location.
if self.trajectory.GetStringSelection() == 'No':
self.trajectory_to_plot.Hide()
self.SetSizer(self.sizer)
self.sizer.Fit(self)
self.bodyparts = []

def getbp(self,event):
self.bodyparts = list(self.trajectory_to_plot.GetCheckedStrings())
18 changes: 11 additions & 7 deletions deeplabcut/gui/create_new_project.py
Expand Up @@ -22,6 +22,7 @@
from deeplabcut.gui.evaluate_network import Evaluate_network
from deeplabcut.gui.extract_outlier_frames import Extract_outlier_frames
from deeplabcut.gui.refine_labels import Refine_labels
from deeplabcut.gui.create_videos import Create_Labeled_Videos

media_path = os.path.join(deeplabcut.__path__[0], 'gui' , 'media')
logo = os.path.join(media_path,'logo.png')
Expand All @@ -41,7 +42,7 @@ def __init__(self, parent,gui_size):
self.loaded = False

# design the panel
self.sizer = wx.GridBagSizer(5, 8)
self.sizer = wx.GridBagSizer(10, 15)

text1 = wx.StaticText(self, label="DeepLabCut - Step 1. Create New Project")
self.sizer.Add(text1, pos=(0, 0), flag=wx.TOP|wx.LEFT|wx.BOTTOM,border=15)
Expand All @@ -55,20 +56,20 @@ def __init__(self, parent,gui_size):

# Add all the options
self.proj = wx.RadioBox(self, label='Please choose an option:', choices=['Create new project', 'Load existing project'],majorDimension=0, style=wx.RA_SPECIFY_COLS)
self.sizer.Add(self.proj, pos=(2, 0), span=(1, 6), flag=wx.LEFT, border=10)
self.sizer.Add(self.proj, pos=(2, 0), span=(1, 5), flag=wx.LEFT, border=15)
self.proj.Bind(wx.EVT_RADIOBOX,self.chooseOption)

line = wx.StaticLine(self)
self.sizer.Add(line, pos=(3, 0), span=(1, 8),flag=wx.EXPAND|wx.BOTTOM, border=10)

self.proj_name = wx.StaticText(self, label="Name of the project:")
self.sizer.Add(self.proj_name, pos=(4, 0), flag=wx.LEFT, border=10)
self.sizer.Add(self.proj_name, pos=(4, 0), flag=wx.LEFT, border=15)

self.proj_name_txt_box = wx.TextCtrl(self)
self.sizer.Add(self.proj_name_txt_box, pos=(4, 1), span=(1, 2), flag=wx.TOP|wx.EXPAND)

self.exp = wx.StaticText(self, label="Name of the experimenter:")
self.sizer.Add(self.exp, pos=(5, 0), flag=wx.LEFT|wx.TOP, border=10)
self.sizer.Add(self.exp, pos=(5, 0), flag=wx.LEFT|wx.TOP, border=15)

self.exp_txt_box = wx.TextCtrl(self)
self.sizer.Add(self.exp_txt_box, pos=(5, 1), span=(1, 2), flag=wx.TOP|wx.EXPAND,border=5)
Expand All @@ -77,7 +78,7 @@ def __init__(self, parent,gui_size):
self.sizer.Add(self.vids, pos=(6, 0), flag=wx.TOP|wx.LEFT, border=10)

self.sel_vids = wx.Button(self, label="Load Videos")
self.sizer.Add(self.sel_vids, pos=(6, 1), flag=wx.TOP|wx.EXPAND, border=5)
self.sizer.Add(self.sel_vids, pos=(6, 1), flag=wx.TOP|wx.EXPAND, border=6)
self.sel_vids.Bind(wx.EVT_BUTTON, self.select_videos)
#
sb = wx.StaticBox(self, label="Optional Attributes")
Expand Down Expand Up @@ -110,7 +111,7 @@ def __init__(self, parent,gui_size):
self.sizer.Add(self.boxsizer, pos=(7, 0), span=(1, 7),flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)

self.cfg_text = wx.StaticText(self, label="Select the config file")
self.sizer.Add(self.cfg_text, pos=(8, 0), flag=wx.LEFT|wx.EXPAND, border=10)
self.sizer.Add(self.cfg_text, pos=(8, 0), flag=wx.LEFT|wx.EXPAND, border=15)

if sys.platform=='darwin':
self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="*.yaml")
Expand Down Expand Up @@ -173,7 +174,8 @@ def chooseOption(self,event):
self.copy_choice.Enable(False)
self.sel_config.Show()
self.cfg_text.Show()
self.SetSizer(self.sizer)
#self.SetSizer(self.sizer)
#self.sizer.Add(self.sizer, pos=(3, 0), span=(1, 8),flag=wx.EXPAND|wx.BOTTOM, border=15)
self.sizer.Fit(self)
else:
self.proj_name.Enable(True)
Expand Down Expand Up @@ -299,6 +301,8 @@ def create_new_project(self,event):
self.parent.AddPage(page7, "Evaluate network")
page8 = Analyze_videos(self.parent,self.gui_size,self.cfg)
self.parent.AddPage(page8, "Analyze videos")
page11 = Create_Labeled_Videos(self.parent,self.gui_size,self.cfg)
self.parent.AddPage(page11, "Create Videos")
page9 = Extract_outlier_frames(self.parent,self.gui_size,self.cfg)
self.parent.AddPage(page9, "Extract outlier frames")
page10 = Refine_labels(self.parent,self.gui_size,self.cfg,page5)
Expand Down

0 comments on commit 8c6a766

Please sign in to comment.