Issue with using deeplabcut.extract_frames

Hi, I am new to Python and deeplabcut and I use Windows 10. While I was trying to figure out how to use deeplabcut, I got stuck at deeplabcut.extract_frames. Please see the following (Jupyter Notebook):

TypeError Traceback (most recent call last)
in ()
2 deeplabcut.create_new_project(“trial1”, “ZG” ,[“C:/Users/ZGM/Desktop/w1118/wt2.mp4”, “C:/Users/ZGM/Desktop/w1118/wt3.mp4”, “C:/Users/ZGM/Desktop/w1118/wt4.mp4”], working_directory=‘C:/Users/ZGM/Desktop/w1118’, copy_videos=True)
3 config_path = deeplabcut.create_new_project(“trial1”, “ZG” ,[“C:/Users/ZGM/Desktop/w1118/wt2.mp4”, “C:/Users/ZGM/Desktop/w1118/wt3.mp4”, “C:/Users/ZGM/Desktop/w1118/wt4.mp4”], working_directory=‘C:/Users/ZGM/Desktop/w1118’, copy_videos=True)
----> 4 deeplabcut.extract_frames(config_path,‘automatic’,‘uniform’)
5

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\site-packages\deeplabcut\generate_training_dataset\frame_extraction.py in extract_frames(config, mode, algo, crop, userfeedback, cluster_step, cluster_resizewidth, cluster_color, opencv, slider_width)
103
104 elif mode == “automatic”:
–> 105 config_file = Path(config).resolve()
106 cfg = auxiliaryfunctions.read_config(config_file)
107 print(“Config file read successfully.”)

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\pathlib.py in new(cls, *args, **kwargs)
999 if cls is Path:
1000 cls = WindowsPath if os.name == ‘nt’ else PosixPath
-> 1001 self = cls._from_parts(args, init=False)
1002 if not self._flavour.is_supported:
1003 raise NotImplementedError(“cannot instantiate %r on your system”

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\pathlib.py in _from_parts(cls, args, init)
654 # right flavour.
655 self = object.new(cls)
–> 656 drv, root, parts = self._parse_args(args)
657 self._drv = drv
658 self._root = root

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\pathlib.py in _parse_args(cls, args)
638 parts += a._parts
639 else:
–> 640 a = os.fspath(a)
641 if isinstance(a, str):
642 # Force-cast str subclasses to str (issue #21127)

TypeError: expected str, bytes or os.PathLike object, not NoneType

Many thanks!

So, two issues.

(1) you can’t run create_project twice.

(2) your paths are incorrectly formatted.

You can run a command with “?” this to see any functions help: i.e.deeplabcut.create_new_project?

FIX: you can either run [see my EDITS]!:

config_path = deeplabcut.create_new_project('trial1', 'ZG',['C://Users//ZGM//Desktop//w1118//wt2.mp4', 'C://Users//ZGM//Desktop//w1118//wt3.mp4', 'C://Users//ZGM//Desktop//w1118//wt4.mp4'], working_directory=‘C://Users//ZGM//Desktop//w1118’, videotype='mp4', copy_videos=True)

OR:

deeplabcut.create_new_project('trial1', 'ZG',['C://Users//ZGM//Desktop//w1118//wt2.mp4', 'C://Users//ZGM//Desktop//w1118//wt3.mp4', 'C://Users//ZGM//Desktop//w1118//wt4.mp4'], working_directory=‘C://Users//ZGM//Desktop//w1118’, videotype='mp4', copy_videos=True)

THEN set the path: config_path =r'C:/Users/ZGM/Desktop/w1118/trial1-ZG-2019-08-05/config.yaml'

Please check out the user guide carefully, as the paths will become very important for many steps: https://rdcu.be/bHpHN

Your code:

TypeError Traceback (most recent call last)
in ()
2 deeplabcut.create_new_project(“trial1”, “ZG” ,[“C:/Users/ZGM/Desktop/w1118/wt2.mp4”, “C:/Users/ZGM/Desktop/w1118/wt3.mp4”, “C:/Users/ZGM/Desktop/w1118/wt4.mp4”], working_directory=‘C:/Users/ZGM/Desktop/w1118’, copy_videos=True)
3 config_path = deeplabcut.create_new_project(“trial1”, “ZG” ,[“C:/Users/ZGM/Desktop/w1118/wt2.mp4”, “C:/Users/ZGM/Desktop/w1118/wt3.mp4”, “C:/Users/ZGM/Desktop/w1118/wt4.mp4”], working_directory=‘C:/Users/ZGM/Desktop/w1118’, copy_videos=True)
----> 4 deeplabcut.extract_frames(config_path,‘automatic’,‘uniform’)
5

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\site-packages\deeplabcut\generate_training_dataset\frame_extraction.py in extract_frames(config, mode, algo, crop, userfeedback, cluster_step, cluster_resizewidth, cluster_color, opencv, slider_width)
103
104 elif mode == “automatic”:
–> 105 config_file = Path(config).resolve()
106 cfg = auxiliaryfunctions.read_config(config_file)
107 print(“Config file read successfully.”)

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\pathlib.py in  **new** (cls, *args, **kwargs)
999 if cls is Path:
1000 cls = WindowsPath if os.name == ‘nt’ else PosixPath
-> 1001 self = cls._from_parts(args, init=False)
1002 if not self._flavour.is_supported:
1003 raise NotImplementedError(“cannot instantiate %r on your system”

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\pathlib.py in _from_parts(cls, args, init)
654 # right flavour.
655 self = object. **new** (cls)
–> 656 drv, root, parts = self._parse_args(args)
657 self._drv = drv
658 self._root = root

C:\Users\ZGM\Anaconda3\envs\dlc-windowsCPU\lib\pathlib.py in _parse_args(cls, args)
638 parts += a._parts
639 else:
–> 640 a = os.fspath(a)
641 if isinstance(a, str):
642 # Force-cast str subclasses to str (issue #21127)

TypeError: expected str, bytes or os.PathLike object, not NoneType

Thank you very much! I will try your fix.