Skip to content

cannot pickle 'memoryview' object on pytorch deeplabcut #2739

@jakemanger

Description

@jakemanger

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

After training a model using the deeplabcut GUI and then running Analyze videos on any video, I always get this error:

(DEEPLABCUT) jake@dep65287:~/projects/hyperiid_dlc$ python -m deeplabcut
Loading DLC 3.0.0rc4...
Starting GUI...
QPixmap::scaled: Pixmap is a null pixmap
INFO:console:Analyzing videos with /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/dlc-models-pytorch/iteration-0/HyperiidMay31-trainset95shuffle1/train/snapshot-200.pt
INFO:console:  -> Using detector /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/dlc-models-pytorch/iteration-0/HyperiidMay31-trainset95shuffle1/train/snapshot-detector-200.pt
INFO:console:Starting to analyze /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippet.mp4
INFO:console:Video metadata: 
  Overall # of frames:    930
  Duration of video [s]:  31.04
  fps:                    29.96
  resolution:             w=950, h=980

INFO:console:Running detector with batch size 1
100%|█████████████████████████████████████████████████████████████████████████▉| 929/930 [00:23<00:00, 39.60it/s]
  0%|                                                                                    | 0/930 [00:00<?, ?it/s]INFO:console:Running pose prediction with batch size 32
100%|█████████████████████████████████████████████████████████████████████████▉| 929/930 [00:39<00:00, 23.66it/s]
WARNING:root:The video metadata indicates that there 930 in the video, but only 929 were able to be processed. This can happen if the video is corrupted. You can try to fix the issue by re-encoding your video (tips on how to do that: https://deeplabcut.github.io/DeepLabCut/docs/recipes/io.html#tips-on-video-re-encoding-and-preprocessing)
INFO:console:Saving results in /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippetDLC_AnimaltokenposeBase_HyperiidMay31shuffle1_detector_200_snapshot_200.h5 and /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippetDLC_AnimaltokenposeBase_HyperiidMay31shuffle1_detector_200_snapshot_200_full.pickle
INFO:console:Processing... 
INFO:console: 
INFO:console:/home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippet.mp4
INFO:console:Loading From /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippetDLC_AnimaltokenposeBase_HyperiidMay31shuffle1_detector_200_snapshot_200.h5
929it [00:00, 1004772.67it/s]
Traceback (most recent call last):
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/gui/utils.py", line 22, in run
    self.func()
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/compat.py", line 865, in analyze_videos
    return analyze_videos(
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/pose_estimation_pytorch/apis/analyze_videos.py", line 384, in analyze_videos
    convert_detections2tracklets(
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/pose_estimation_pytorch/apis/convert_detections_to_tracklets.py", line 241, in convert_detections2tracklets
    pickle.dump(tracklets, f, pickle.HIGHEST_PROTOCOL)
TypeError: cannot pickle 'memoryview' object

I don't get this error on the older tensorflow version of the software. However, I have extreme trouble getting that to work with my GPU, so that's why I updated to the pytorch 3.0.0 version.

Operating System

Ubuntu 20.04.6 LTS

DeepLabCut version

3.0.0rc4

DeepLabCut mode

multi animal

Device type

NVIDIA GeForce RTX 3090

Steps To Reproduce

  1. Using the conda DEEPLABCUT.yaml from the instructions, install to conda
  2. Activate the environment.
  3. Train a model using pytorch environment
  4. Run analyze videos using any number of videos

Relevant log output

(DEEPLABCUT) jake@dep65287:~/projects/hyperiid_dlc$ python -m deeplabcut
Loading DLC 3.0.0rc4...
Starting GUI...
QPixmap::scaled: Pixmap is a null pixmap
INFO:console:Analyzing videos with /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/dlc-models-pytorch/iteration-0/HyperiidMay31-trainset95shuffle1/train/snapshot-200.pt
INFO:console:  -> Using detector /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/dlc-models-pytorch/iteration-0/HyperiidMay31-trainset95shuffle1/train/snapshot-detector-200.pt
INFO:console:Starting to analyze /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippet.mp4
INFO:console:Video metadata: 
  Overall # of frames:    930
  Duration of video [s]:  31.04
  fps:                    29.96
  resolution:             w=950, h=980

INFO:console:Running detector with batch size 1
100%|█████████████████████████████████████████████████████████████████████████▉| 929/930 [00:23<00:00, 39.60it/s]
  0%|                                                                                    | 0/930 [00:00<?, ?it/s]INFO:console:Running pose prediction with batch size 32
100%|█████████████████████████████████████████████████████████████████████████▉| 929/930 [00:39<00:00, 23.66it/s]
WARNING:root:The video metadata indicates that there 930 in the video, but only 929 were able to be processed. This can happen if the video is corrupted. You can try to fix the issue by re-encoding your video (tips on how to do that: https://deeplabcut.github.io/DeepLabCut/docs/recipes/io.html#tips-on-video-re-encoding-and-preprocessing)
INFO:console:Saving results in /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippetDLC_AnimaltokenposeBase_HyperiidMay31shuffle1_detector_200_snapshot_200.h5 and /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippetDLC_AnimaltokenposeBase_HyperiidMay31shuffle1_detector_200_snapshot_200_full.pickle
INFO:console:Processing... 
INFO:console: 
INFO:console:/home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippet.mp4
INFO:console:Loading From /home/jake/projects/hyperiid_dlc/dlc_projects/hyperia-Jake-2023-05-31/videos/16L-processed-snippetDLC_AnimaltokenposeBase_HyperiidMay31shuffle1_detector_200_snapshot_200.h5
929it [00:00, 1004772.67it/s]
Traceback (most recent call last):
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/gui/utils.py", line 22, in run
    self.func()
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/compat.py", line 865, in analyze_videos
    return analyze_videos(
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/pose_estimation_pytorch/apis/analyze_videos.py", line 384, in analyze_videos
    convert_detections2tracklets(
  File "/home/jake/anaconda3/envs/DEEPLABCUT/lib/python3.10/site-packages/deeplabcut/pose_estimation_pytorch/apis/convert_detections_to_tracklets.py", line 241, in convert_detections2tracklets
    pickle.dump(tracklets, f, pickle.HIGHEST_PROTOCOL)
TypeError: cannot pickle 'memoryview' object

Anything else?

No response

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions