Visitar URL original
incorrectly formatted yaml file for long file name · Issue #3119 · DeepLabCut/DeepLabCut · GitHub
Skip to content

incorrectly formatted yaml file for long file name #3119

Closed

Description

@Jiefei-Wang

Is there an existing issue for this?

  • I have searched the existing issues

Operating System

windows

DeepLabCut version

'3.0.0rc13'

What engine are you using?

pytorch

DeepLabCut mode

single animal

Device type

5090

Bug description 🐛

Hi,

The config YAML cannot handle a long file name with a space; whenever I call deeplabcut.convertcsv2h5, it attempts to format my config file and eventually make the YAML invalid. I think the root cause is that ruamel.yaml cannot reliably store the YAML setting. Here is a simple repex

from ruamel.yaml import YAML
ruamelFile = YAML()
# a dummpy config file
cfg = {
    'video_sets': {
        'G:/My Drive/lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllong_name.mp4': {
            'crop': [0, 1280, 0, 720]
        }
    }
}

# save to yaml
with open("test.yaml", "w") as cf:
    ruamelFile.dump(cfg, cf)
    
# Error: mapping values are not allowed here
with open("test.yaml", "r") as f:
    cfg = ruamelFile.load(f)

Here is the resulting YAML:

video_sets:
  G:/My 
    Drive/lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllong_name.mp4:
    crop:
    - 0
    - 1280
    - 0
    - 720

It seems like ruamelFile.dump is not happy with the space in the video path. However, there is no way for me to avoid it since it is a Google Drive. using ruamelFile = YAML(typ="full") can solve the issue, but it will result in an unreadable YAML (I assume the motivation for using ruamel is readability? Otherwise yaml package can dump the data perfectly fine)

I found a similar issue in this repository: #3063

Steps To Reproduce

No response

Relevant log output

Anything else?

This is the actual config file deeplabcut.convertcsv2h5 will create

# Project definitions (do not edit)
Task: Sleap_Rat_test
scorer: T
date: Oct2
multianimalproject: false
identity:


# Project path (change when moving around)
project_path: G:\My 
  Drive\projects\Green_Tom\rat_pose\post_model\projects\rat_pose


# Default DeepLabCut engine to use for shuffle creation (either pytorch or tensorflow)
engine: pytorch


# Annotation data set configuration (and individual video cropping parameters)
video_sets:
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai1.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai2.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai3.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai4.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai5.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai6.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai7.mp4:
    crop: 0, 1280, 0, 720
  G:/My 
    Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai8.mp4:
    crop: 0, 1280, 0, 720
  G:\My Drive\projects\Green Tom\rat_pose\post_model\videos\Camera4_stitched.mp4:
    crop: 0, 1280, 0, 720
  G:\My Drive\projects\Green Tom\rat_pose\post_model\videos\RAT 11 FR1.mp4:
    crop: 0, 1280, 0, 720
bodyparts:
- head
- nose
- spine1
- spine2
- spine3
- tailbase
- tail1
- tail2
- tail_tip
- L_hip
- L_backpaw
- R_backpaw
- L_shoulder
- R_frontpaw
- R_shoulder
- R_hip
- R_knee
- L_knee
- L_frontpaw


# Fraction of video to start/stop when extracting frames for labeling/refinement
start: 0
stop: 1
numframes2pick: 20


# Plotting configuration
skeleton:
- - head
  - nose
- - head
  - spine1
- - spine1
  - spine2
- - spine2
  - spine3
- - spine1
  - L_shoulder
- - L_shoulder
  - L_frontpaw
- - spine3
  - L_hip
- - L_hip
  - L_knee
- - L_knee
  - L_backpaw
- - spine3
  - tailbase
- - tailbase
  - tail1
- - tail1
  - tail2
- - tail2
  - tail_tip
- - spine1
  - R_shoulder
- - R_shoulder
  - R_frontpaw
- - spine3
  - R_hip
- - R_hip
  - R_knee
- - R_knee
  - R_backpaw
skeleton_color: black
pcutoff: 0.6
dotsize: 12
alphavalue: 0.7
colormap: rainbow


# Training,Evaluation and Analysis configuration
TrainingFraction:
- 0.95
iteration: 0
default_net_type: resnet_50
default_augmenter: default
snapshotindex: -1
detector_snapshotindex: -1
batch_size: 8
detector_batch_size: 1


# Cropping Parameters (for analysis and outlier frame detection)
cropping: false
#if cropping is true for analysis, then set the values here:
x1: 0
x2: 640
y1: 277
y2: 624


# Refinement configuration (parameters from annotation dataset configuration also relevant in this stage)
corner2move2:
- 50
- 50
move2corner: true


# Conversion tables to fine-tune SuperAnimal weights
SuperAnimalConversionTables:

It might be somehow related to the recent change in ruamel-yaml. Downgrading ruamel in the package requirement might help.

https://sourceforge.net/p/ruamel-yaml/tickets/546/

Code of Conduct

Activity

  1. toniklenk commented on Nov 4, 2025

    @toniklenk

    i have a similar issue, triggered if a long filename gets a line break inserted upon using deeplabcut.add_new_video

  2. AlexEMG commented on Nov 5, 2025

    @AlexEMG
    Member

    Ok, here is a quick fix for the broken config file, can you just manually write:

    "G:/My Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai1.mp4":
        crop: 0, 1280, 0, 720
    
  3. added a commit that references this issue on Nov 7, 2025
    afe6877
  4. Jiefei-Wang commented on Nov 13, 2025

    @Jiefei-Wang
    ContributorAuthor

    Ok, here is a quick fix for the broken config file, can you just manually write:

    "G:/My Drive/projects/Green_Tom/rat_pose/post_model/projects/rat_pose/videos/ai1.mp4":
        crop: 0, 1280, 0, 720
    

    Thanks for the reply. I see DEEPLABCUT always format my relative path to the full path. Is there any motivation to use the full video path in the config file? Since the videos are always in the project folder, I'm having a feeling that a relative path (relative to the project path) is a better way to store the path.

  5. deruyter92 commented on Dec 18, 2025

    @deruyter92
    Collaborator

    @Jiefei-Wang, glad the quick fix worked for you. It was an issue with one of the packages that we are using, and we are currently implementing a more permanent fix to prevent this happening in the future. To address your last question: for some functions (e.g. video inference) the videos don't need to be inside the project folder. Also some of our scripts change the current working directory. Specifying the full path is a design choice that currently works best. Thanks nevertheless for sharing your feedback.

  6. added a commit that references this issue on Jan 26, 2026
    3ec4180
  7. added theissue type on Feb 4, 2026
  8. added a commit that references this issue on Feb 10, 2026
    2a3e5cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

another package code issueBug/issue that relates to a dlc dependencybugSomething isn't working

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions