Skip to content

Video Analysis Error(s). M1 max. GUI error: "ValueError: array must not contain infs or NaNs", command line error: "ValueError: not enough values to unpack (expected 2, got 0)" #2146

@aredwine3

Description

@aredwine3

Is there an existing issue for this?

  • I have searched the existing issues

Bug description

When analyzing videos I do not get a .csv file or video with all detections created, even though those options are selected in the GUI. The only files that are output at a "...meta.pickle" and "...full.pickle" for the video I had selected to be analyzed. However, when attempting to analyze videos through the command line I receive additional output files ending in "...el.pickle" and "...assemblies.pickle" but still no .csv, .h5, or video with detections.

Operating System

macOS Ventura 13.2

DeepLabCut version

DLC Version: 2.3.0

Napari Version: 0.1.1.dev3+g5a5709d

DeepLabCut mode

multi animal

Device type

M1 Max

Steps To Reproduce

GUI Route

At the command line:

  1. Enter "conda activate DEEPLABCUT_M1"
  2. Enter "python -m deeplabcut"

In the GUI:

  1. Select config file for project
  2. (Under analyze video tab) Select: Calibrate assembly, Create video with all detections, Save result(s) as csv
  • Note: It doesn't matter if I also select Filter predictions and Plot trajectories. The error I receive is the same.
  1. Analyze Video

Command Line Route

At the command Line:

  1. "python"
  2. "import deeplabcut"
  3. "config_path = '/Users/adanredwine/Desktop/OpenArena-RedwineAdan-2023-01-05/config.yaml'"
  4. "deeplabcut.analyze_videos(config_path, ['/Users/adanredwine/Desktop/Test_ShortVideo.mp4'], shuffle=4, save_as_csv=True, videotype='.mp4')"

Relevant log output

# GUI Route

Loading DLC 2.3.0...
Starting GUI...
2023-02-05 16:10:45.094 python[15989:6016883] +[CATransaction synchronize] called within transaction
2023-02-05 16:16:01.980 python[15989:6016883] +[CATransaction synchronize] called within transaction
/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/tensorflow/python/keras/engine/base_layer_v1.py:1694: UserWarning: `layer.apply` is deprecated and will be removed in a future version. Please use `layer.__call__` method instead.
  warnings.warn('`layer.apply` is deprecated and '
Traceback (most recent call last):
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/utils/auxfun_multianimal.py", line 217, in LoadFullMultiAnimalData
    with open(data_file, "rb") as handle:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/adanredwine/Desktop/Test_ShortVideoDLC_resnet50_OpenArenaJan5shuffle4_135000_full.pickle'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/gui/tabs/analyze_videos.py", line 324, in analyze_videos
    deeplabcut.create_video_with_all_detections(
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/utils/make_labeled_video.py", line 979, in create_video_with_all_detections
    data, _ = auxfun_multianimal.LoadFullMultiAnimalData(h5file)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/utils/auxfun_multianimal.py", line 220, in LoadFullMultiAnimalData
    data = shelve.open(data_file, flag="r")
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/shelve.py", line 243, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/shelve.py", line 227, in __init__
    Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/dbm/__init__.py", line 85, in open
    raise error[0]("db file doesn't exist; "
dbm.error: db file doesn't exist; use 'c' or 'n' flag to create a new db
Metal device set to: Apple M1 Max

systemMemory: 64.00 GB
maxCacheSize: 24.00 GB

2023-02-05 16:16:30.399725: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:306] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2023-02-05 16:16:30.399883: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:272] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)
2023-02-05 16:16:30.414092: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled
2023-02-05 16:16:30.426524: W tensorflow/core/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz
2023-02-05 16:16:30.428923: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
2023-02-05 16:16:30.946282: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
2023-02-05 16:16:30.955074: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
  0%|                                                                                                                                | 0/8604 [00:00<?, ?it/s]2023-02-05 16:16:31.345890: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8604/8604 [03:53<00:00, 36.84it/s]/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/pose_estimation_tensorflow/lib/inferenceutils.py:301: RuntimeWarning: Mean of empty slice
  mu = np.nanmean(dists, axis=0)
Traceback (most recent call last):
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/gui/utils.py", line 22, in run
    self.func()
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/pose_estimation_tensorflow/predict_videos.py", line 640, in analyze_videos
    convert_detections2tracklets(
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/pose_estimation_tensorflow/predict_videos.py", line 1818, in convert_detections2tracklets
    ass.calibrate(train_data_file)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/pose_estimation_tensorflow/lib/inferenceutils.py", line 305, in calibrate
    kde = gaussian_kde(dists.T)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/scipy/stats/_kde.py", line 207, in __init__
    self.set_bandwidth(bw_method=bw_method)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/scipy/stats/_kde.py", line 555, in set_bandwidth
    self._compute_covariance()
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/scipy/stats/_kde.py", line 567, in _compute_covariance
    self._data_inv_cov = linalg.inv(self._data_covariance)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/scipy/linalg/_basic.py", line 927, in inv
    a1 = _asarray_validated(a, check_finite=check_finite)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/scipy/_lib/_util.py", line 287, in _asarray_validated
    a = toarray(a)
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/numpy/lib/function_base.py", line 627, in asarray_chkfinite
    raise ValueError(
ValueError: array must not contain infs or NaNs


# Command Line Route

❯ python
Python 3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:48:25) 
[Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import deeplabcut
Loading DLC 2.3.0...
>>> config_path = '/Users/adanredwine/Desktop/OpenArena-RedwineAdan-2023-01-05/config.yaml'
>>> deeplabcut.analyze_videos(config_path, ['/Users/adanredwine/Desktop/Test_ShortVideo.mp4'], shuffle=4, save_as_csv=True, videotype='.mp4')
Using snapshot-135000 for model /Users/adanredwine/Desktop/OpenArena-RedwineAdan-2023-01-05/dlc-models/iteration-0/OpenArenaJan5-trainset95shuffle4
/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/tensorflow/python/keras/engine/base_layer_v1.py:1694: UserWarning: `layer.apply` is deprecated and will be removed in a future version. Please use `layer.__call__` method instead.
  warnings.warn('`layer.apply` is deprecated and '
Activating extracting of PAFs
Metal device set to: Apple M1 Max

systemMemory: 64.00 GB
maxCacheSize: 24.00 GB

2023-02-05 16:45:07.056795: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:306] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.
2023-02-05 16:45:07.056969: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:272] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)
2023-02-05 16:45:07.070648: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled
2023-02-05 16:45:07.083392: W tensorflow/core/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz
2023-02-05 16:45:07.085747: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
2023-02-05 16:45:07.556080: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
2023-02-05 16:45:07.564346: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
Starting to analyze %  /Users/adanredwine/Desktop/Test_ShortVideo.mp4
Loading  /Users/adanredwine/Desktop/Test_ShortVideo.mp4
Duration of video [s]:  286.8 , recorded with  30.0 fps!
Overall # of frames:  8604  found with (before cropping) frame dimensions:  1280 720
Starting to extract posture from the video(s) with batchsize: 10
  0%|                                                                                                                              | 0/8604 [00:00<?, ?it/s]2023-02-05 16:45:07.943733: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:114] Plugin optimizer for device_type GPU is enabled.
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8604/8604 [03:53<00:00, 36.78it/s]
Video Analyzed. Saving results in /Users/adanredwine/Desktop...
Using snapshot-135000 for model /Users/adanredwine/Desktop/OpenArena-RedwineAdan-2023-01-05/dlc-models/iteration-0/OpenArenaJan5-trainset95shuffle4
Processing...  /Users/adanredwine/Desktop/Test_ShortVideo.mp4
Analyzing /Users/adanredwine/Desktop/Test_ShortVideoDLC_resnet50_OpenArenaJan5shuffle4_135000.h5
8604it [00:01, 7587.25it/s]
8604it [00:00, 4841399.47it/s]
The tracklets were created (i.e., under the hood deeplabcut.convert_detections2tracklets was run). Now you can 'refine_tracklets' in the GUI, or run 'deeplabcut.stitch_tracklets'.
Processing...  /Users/adanredwine/Desktop/Test_ShortVideo.mp4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/pose_estimation_tensorflow/predict_videos.py", line 651, in analyze_videos
    stitch_tracklets(
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/refine_training_dataset/stitch.py", line 1177, in stitch_tracklets
    stitcher = TrackletStitcher.from_pickle(
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/refine_training_dataset/stitch.py", line 522, in from_pickle
    class_ = cls.from_dict_of_dict(
  File "/Users/adanredwine/miniconda/envs/DEEPLABCUT_M1/lib/python3.9/site-packages/deeplabcut/refine_training_dataset/stitch.py", line 541, in from_dict_of_dict
    inds, data = zip(*[(cls.get_frame_ind(k), v) for k, v in dict_.items()])
ValueError: not enough values to unpack (expected 2, got 0)

Anything else?

No response

Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions