Closed palmcorp closed 2 months ago
π Hello @palmcorp, thank you for raising an issue about Ultralytics HUB π! Please visit our HUB Docs to learn more:
If this is a π Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.
If this is a β Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.
We try to respond to all issues as promptly as possible. Thank you for your patience!
Hello!
Thank you for reaching out. It looks like you're looking for the yolov8n-pose.yaml
file. This file is part of the configuration files used for YOLOv8 models, specifically for pose estimation.
You can find the configuration files for YOLOv8, including yolov8n-pose.yaml
, in the Ultralytics GitHub repository. Here is a direct link to the YOLOv8 configuration files.
If you have any further questions or need additional assistance, feel free to ask. We're here to help! π
Hi Paula,
Thanks again for your help.
Oops, Checked the references.. and no joy:
Iβm trying to track down why Yolo wants to see 15 columns in the labels. As near as I can see we have that.
Should I chnge kpt_shape: [5, 2] -> kpt_shape: [17,2]???
Is there some parameter in yolov8n-pose.yaml that is overriding what is in our data.yaml?
Should I remove loading a pertained yolo model before calling my model.training command?
Not sure which direction to take things at this point.
REERENCE CHECK:
Ref one: GitHub Repository has several .yaml files , but not yolov8n-pose.yaml
Closest is config.yaml
Ref two: is 404 - page not found
LABEL COMPARISON
Here are one of our labels compared to a cocolabel.
ECHO LABELS
0 class
686445 0.531960 0.082891 0.323967 (bbox)
0.667188 0.399061 1.000000 label #1
0.670312 0.396714 2.000000
0.0 0.00000000 0.0000000
.678125 0.394366 2.000000
0.0 0.00000000 0.0000000
0.689063 0.415493 2.000000
0.696875 0.415493 2.000000
0.682813 0.469484 2.000000
0.671875 0.483568 2.000000
0.671875 0.516432 2.000000
0.656250 0.504695 2.000000
0.695312 0.530516 2.000000
0.706250 0.523474 2.000000
0.698438 0.610329 2.000000
0.709375 0.603286 2.000000
0.710938 0.680751 2.000000
0.717187 0.671362 2.000000
17 KEY POINTS
Following is a typical COCO label:
0 (class)
0.620039 0.593900 0.172415 0.146080 (bbox)
0.658793 0.552000 2.000000 label#1
0.664042 0.550000 2.000000 etc.
3 0.656168 0.548000 2.000000
4 0.679790 0.554000 2.000000
5 0.000000 0.000000 0.000000
6 0.679790 0.570000 2.000000
7 0.648294 0.568000 2.000000
8 0.674541 0.588000 2.000000
9 0.606299 0.582000 2.000000
10 0.627297 0.562000 2.000000
11 0.603675 0.564000 2.000000
12 0.627297 0.616000 2.000000
13 0.000000 0.000000 0.000000
14 0.595801 0.604000 2.000000
15 0.000000 0.000000 0.000000
16 0.569554 0.644000 2.000000
17 0.000000 0.000000 0.000000
17 keypoints
From: Paula Derrenger @.*** Sent: Tuesday, June 11, 2024 4:48 PM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hello!
Thank you for reaching out. It looks like you're looking for the yolov8n-pose.yaml file. This file is part of the configuration files used for YOLOv8 models, specifically for pose estimation.
You can find the configuration files for YOLOv8, including yolov8n-pose.yaml, in the Ultralytics GitHub repository https://github.com/ultralytics/ultralytics . Here is a direct link to the YOLOv8 configuration files https://github.com/ultralytics/ultralytics/tree/main/models/yolo .
If you have any further questions or need additional assistance, feel free to ask. We're here to help! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2161790711 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FWML3ZBZZZ65V2UHPDZG6ECRAVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRRG44TANZRGE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FWDOGC5VHSWTW7WR4TZG6ECRA5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUA3JHPO.gif Message ID: @.***>
Hi Paula,
Thank you for providing detailed information about your issue. Let's work through this together to find a solution.
To better assist you, could you please provide a minimum reproducible code example? This will help us understand the context and reproduce the issue on our end. You can refer to our documentation for guidance on creating one. It's crucial for us to be able to reproduce the bug before we can investigate a solution.
Please ensure that you are using the most recent versions of torch
, ultralytics
, and hub-sdk
. If not, please upgrade your packages and try again:
pip install --upgrade torch ultralytics hub-sdk
Regarding the label format, YOLOv8 expects a specific structure for pose estimation. The kpt_shape
parameter in your yolov8n-pose.yaml
should match the number of keypoints in your dataset. If your dataset has 17 keypoints, you should set kpt_shape: [17, 2]
.
Loading a pretrained model should not interfere with your custom training as long as the label formats and configurations are correctly set. However, if you suspect it might be causing issues, you can try training without loading the pretrained model to see if it resolves the problem.
Hereβs an example of what your yolov8n-pose.yaml
might look like:
# YOLOv8n-pose model configuration
kpt_shape: [17, 2]
...
Ensure your data.yaml
file is correctly formatted and includes the necessary parameters:
train: path/to/train/images
val: path/to/val/images
nc: number_of_classes
names: ['class1', 'class2', ...]
If you continue to face issues, please share the specific error messages and any additional context that might help us diagnose the problem.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
Hi Paula,
Good point. Will compile a more complete answer.
Best,
Paul
From: Paula Derrenger @.*** Sent: Tuesday, June 11, 2024 10:26 PM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hi Paula,
Thank you for providing detailed information about your issue. Let's work through this together to find a solution.
Minimum Reproducible Example
To better assist you, could you please provide a minimum reproducible code example? This will help us understand the context and reproduce the issue on our end. You can refer to our documentation https://docs.ultralytics.com/help/minimum_reproducible_example for guidance on creating one. It's crucial for us to be able to reproduce the bug before we can investigate a solution.
Version Check
Please ensure that you are using the most recent versions of torch, ultralytics, and hub-sdk. If not, please upgrade your packages and try again:
pip install --upgrade torch ultralytics hub-sdk
Label Format
Regarding the label format, YOLOv8 expects a specific structure for pose estimation. The kpt_shape parameter in your yolov8n-pose.yaml should match the number of keypoints in your dataset. If your dataset has 17 keypoints, you should set kpt_shape: [17, 2].
Pretrained Model
Loading a pretrained model should not interfere with your custom training as long as the label formats and configurations are correctly set. However, if you suspect it might be causing issues, you can try training without loading the pretrained model to see if it resolves the problem.
Example Configuration
Hereβs an example of what your yolov8n-pose.yaml might look like:
kpt_shape: [17, 2] ...
Data.yaml
Ensure your data.yaml file is correctly formatted and includes the necessary parameters:
train: path/to/train/images val: path/to/val/images nc: number_of_classes names: ['class1', 'class2', ...]
If you continue to face issues, please share the specific error messages and any additional context that might help us diagnose the problem.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2162133069 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FRIVYKGDYY422CYL3LZG7LX3AVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSGEZTGMBWHE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FRTOZBK225NGW6FERLZG7LX3A5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUA36EE2.gif Message ID: @.***>
Have shared a colb notebook for minimum case. Returns the error w/o data.
Best
Paul
From: Paula Derrenger @.*** Sent: Tuesday, June 11, 2024 10:26 PM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hi Paula,
Thank you for providing detailed information about your issue. Let's work through this together to find a solution.
Minimum Reproducible Example
To better assist you, could you please provide a minimum reproducible code example? This will help us understand the context and reproduce the issue on our end. You can refer to our documentation https://docs.ultralytics.com/help/minimum_reproducible_example for guidance on creating one. It's crucial for us to be able to reproduce the bug before we can investigate a solution.
Version Check
Please ensure that you are using the most recent versions of torch, ultralytics, and hub-sdk. If not, please upgrade your packages and try again:
pip install --upgrade torch ultralytics hub-sdk
Label Format
Regarding the label format, YOLOv8 expects a specific structure for pose estimation. The kpt_shape parameter in your yolov8n-pose.yaml should match the number of keypoints in your dataset. If your dataset has 17 keypoints, you should set kpt_shape: [17, 2].
Pretrained Model
Loading a pretrained model should not interfere with your custom training as long as the label formats and configurations are correctly set. However, if you suspect it might be causing issues, you can try training without loading the pretrained model to see if it resolves the problem.
Example Configuration
Hereβs an example of what your yolov8n-pose.yaml might look like:
kpt_shape: [17, 2] ...
Data.yaml
Ensure your data.yaml file is correctly formatted and includes the necessary parameters:
train: path/to/train/images val: path/to/val/images nc: number_of_classes names: ['class1', 'class2', ...]
If you continue to face issues, please share the specific error messages and any additional context that might help us diagnose the problem.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2162133069 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FRIVYKGDYY422CYL3LZG7LX3AVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRSGEZTGMBWHE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FRTOZBK225NGW6FERLZG7LX3A5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUA36EE2.gif Message ID: @.***>
I've shared an item with you:
Copy of MinimumReproducableExample_v2_118.ipynb https://colab.research.google.com/drive/1SuFUnkmyAw5ct-O-4_eNpQc79Eh4_9M8?invite=CPDUq_oD&ts=666a8f71
It's not an attachment -- it's stored online. To open this item, just click
the link above.
Hi Paula, This returns the error w/o data so am sending this colab notebook. here is data5.yaml = = = = = = =
path: /content/datasets/echo-pose train: images/train2017 # subsets to D val: images/val2017 # relative to path
kpt_shape: [5,2] # number of keypoints, number of dim flip_indx: [0,1,2,3,4] # no flipping
backbone:
head:
[-1, 1, nn.Upsample, [None, 2, "nearest"]]
[[-1, 8], 1, Concat, [1]] # cat backbone P5
[-1, 3, C2, [768, False]] # 14
[-1, 1, nn.Upsample, [None, 2, "nearest"]]
[[-1, 6], 1, Concat, [1]] # cat backbone P4
[-1, 3, C2, [512, False]] # 17
[-1, 1, nn.Upsample, [None, 2, "nearest"]]
[[-1, 4], 1, Concat, [1]] # cat backbone P3
[-1, 3, C2, [256, False]] # 20 (P3/8-small)
[-1, 1, Conv, [256, 3, 2]]
[[-1, 17], 1, Concat, [1]] # cat head P4
[-1, 3, C2, [512, False]] # 23 (P4/16-medium)
[-1, 1, Conv, [512, 3, 2]]
[[-1, 14], 1, Concat, [1]] # cat head P5
[-1, 3, C2, [768, False]] # 26 (P5/32-large)
[-1, 1, Conv, [768, 3, 2]]
[[-1, 11], 1, Concat, [1]] # cat head P6
[-1, 3, C2, [1024, False]] # 29 (P6/64-xlarge)
[[20, 23, 26, 29], 1, Pose, [nc, kpt_shape]] # Pose(P3, P4, P5, P6)
names: 0: class0 1: class1 2: class2 3: class3 4: class4
@palmcorp hi Paul,
Thank you for sharing the Colab notebook and the data5.yaml
file. Let's dive into the issue and work towards a solution.
Keypoint Shape Mismatch:
Your data5.yaml
specifies kpt_shape: [5,2]
, which indicates 5 keypoints. However, if your dataset actually contains 17 keypoints, you should update this to kpt_shape: [17,2]
.
Configuration File:
Ensure that your yolov8n-pose.yaml
configuration file aligns with the number of keypoints in your dataset. Hereβs an example configuration snippet:
# YOLOv8n-pose model configuration
kpt_shape: [17, 2]
...
Pretrained Model: If you are loading a pretrained model, ensure that it is compatible with your custom dataset configuration. If you suspect it might be causing issues, try training without loading the pretrained model to see if it resolves the problem.
Update data5.yaml
:
Change the kpt_shape
parameter to match the number of keypoints in your dataset:
kpt_shape: [17, 2] # number of keypoints, number of dimensions
Verify Versions:
Ensure you are using the latest versions of torch
, ultralytics
, and hub-sdk
. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Run the Notebook: After making the above changes, run your Colab notebook again to see if the issue persists.
Hereβs a simplified example of how your yolov8n-pose.yaml
might look:
# YOLOv8n-pose model configuration
kpt_shape: [17, 2]
...
If you continue to face issues, please share the specific error messages and any additional context that might help us diagnose the problem. This will help us provide more targeted assistance.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
Hi Paula,
No Joy.
Updated data.yaml to data17.yaml
Ran a short program to just load the model.
Can you determine from the console printout where the problem is occurring?
Best,
Paul
CODE:
def POSE_LOAD(data_yaml_path):
model = YOLO(data_yaml_path, verbose = True)
model = YOLO('yolov8n-pose.pt') # load a pretrained model (recommended for training)
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
print ("short start with Paula")
Data_Yaml_Path = os.path.join ("/content/yaml_files/data17.yaml")
if not os.path.isfile(Data_Yaml_Path):
pdb.set_trace()
model=POSE_LOAD (Data_Yaml_Path)
pdb.set_trace()
CONSOLE:
short start with Paula
from n params module arguments
0 -1 1 1856 ultralytics.nn.modules.conv.Conv [3, 64, 3, 2]
1 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2]
2 -1 3 279808 ultralytics.nn.modules.block.C2f [128, 128, 3, True]
3 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2]
4 -1 6 2101248 ultralytics.nn.modules.block.C2f [256, 256, 6, True]
5 -1 1 1180672 ultralytics.nn.modules.conv.Conv [256, 512, 3, 2]
6 -1 6 8396800 ultralytics.nn.modules.block.C2f [512, 512, 6, True]
7 -1 1 4720640 ultralytics.nn.modules.conv.Conv [512, 1024, 3, 2]
8 -1 3 17836032 ultralytics.nn.modules.block.C2f [1024, 1024, 3, True]
9 -1 1 2624512 ultralytics.nn.modules.block.SPPF [1024, 1024, 5]
10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
11 [-1, 8] 1 0 ultralytics.nn.modules.conv.Concat [1]
12 -1 3 10132992 ultralytics.nn.modules.block.C2 [2048, 768, 3, False]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1]
15 -1 3 4461568 ultralytics.nn.modules.block.C2 [1280, 512, 3, False]
16 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
17 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1]
18 -1 3 1149440 ultralytics.nn.modules.block.C2 [768, 256, 3, False]
19 -1 1 590336 ultralytics.nn.modules.conv.Conv [256, 256, 3, 2]
20 [-1, 17] 1 0 ultralytics.nn.modules.conv.Concat [1]
21 -1 3 4330496 ultralytics.nn.modules.block.C2 [1024, 512, 3, False]
22 -1 1 2360320 ultralytics.nn.modules.conv.Conv [512, 512, 3, 2]
23 [-1, 14] 1 0 ultralytics.nn.modules.conv.Concat [1]
24 -1 3 9936384 ultralytics.nn.modules.block.C2 [1792, 768, 3, False]
25 -1 1 5309952 ultralytics.nn.modules.conv.Conv [768, 768, 3, 2]
26 [-1, 11] 1 0 ultralytics.nn.modules.conv.Concat [1]
27 -1 3 18098176 ultralytics.nn.modules.block.C2 [2816, 1024, 3, False]
IndexError Traceback (most recent call last)
https://localhost:8080/
3 if not os.path.isfile(Data_Yaml_Path):
4 pdb.set_trace()
----> 5 model=POSE_LOAD (Data_Yaml_Path)
6 pdb.set_trace()
7 frames
https://localhost:8080/
1 print ("Model Steps : load/train/recognize ")
2 def POSE_LOAD(data_yaml_path):
----> 3 model = YOLO(data_yaml_path, verbose = True)
4 model = YOLO('yolov8n-pose.pt') # load a pretrained model (recommended for training)
5 model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
/usr/local/lib/python3.10/dist-packages/ultralytics/models/yolo/model.py https://localhost:8080/ in init(self, model, task, verbose)
21 else:
22 # Continue with default YOLO initialization
---> 23 super().init(model=model, task=task, verbose=verbose)
24
25 @property
/usr/local/lib/python3.10/dist-packages/ultralytics/engine/model.py https://localhost:8080/ in init(self, model, task, verbose)
148 # Load or create new YOLO model
149 if Path(model).suffix in {".yaml", ".yml"}:
--> 150 self._new(model, task=task, verbose=verbose)
151 else:
152 self._load(model, task=task)
/usr/local/lib/python3.10/dist-packages/ultralytics/engine/model.py https://localhost:8080/ in _new(self, cfg, task, model, verbose)
217 self.cfg = cfg
218 self.task = task or guess_model_task(cfg_dict)
--> 219 self.model = (model or self._smart_load("model"))(cfg_dict, verbose=verbose and RANK == -1) # build model
220 self.overrides["model"] = self.cfg
221 self.overrides["task"] = self.task
/usr/local/lib/python3.10/dist-packages/ultralytics/nn/tasks.py https://localhost:8080/ in init(self, cfg, ch, nc, data_kpt_shape, verbose)
382 LOGGER.info(f"Overriding model.yaml kpt_shape={cfg['kpt_shape']} with kpt_shape={data_kpt_shape}")
383 cfg["kpt_shape"] = data_kpt_shape
--> 384 super().init(cfg=cfg, ch=ch, nc=nc, verbose=verbose)
385
386 def init_criterion(self):
/usr/local/lib/python3.10/dist-packages/ultralytics/nn/tasks.py https://localhost:8080/ in init(self, cfg, ch, nc, verbose)
285 LOGGER.info(f"Overriding model.yaml nc={self.yaml['nc']} with nc={nc}")
286 self.yaml["nc"] = nc # override YAML value
--> 287 self.model, self.save = parse_model(deepcopy(self.yaml), ch=ch, verbose=verbose) # model, savelist
288 self.names = {i: f"{i}" for i in range(self.yaml["nc"])} # default names dict
289 self.inplace = self.yaml.get("inplace", True)
/usr/local/lib/python3.10/dist-packages/ultralytics/nn/tasks.py https://localhost:8080/ in parse_model(d, ch, verbose)
915 c2 = sum(ch[x] for x in f)
916 elif m in {Detect, WorldDetect, Segment, Pose, OBB, ImagePoolingAttn}:
--> 917 args.append([ch[x] for x in f])
918 if m is Segment:
919 args[2] = make_divisible(min(args[2], max_channels) * width, 8)
/usr/local/lib/python3.10/dist-packages/ultralytics/nn/tasks.py https://localhost:8080/ in
915 c2 = sum(ch[x] for x in f)
916 elif m in {Detect, WorldDetect, Segment, Pose, OBB, ImagePoolingAttn}:
--> 917 args.append([ch[x] for x in f])
918 if m is Segment:
919 args[2] = make_divisible(min(args[2], max_channels) * width, 8)
IndexError: list index out of range
From: Paula Derrenger @.*** Sent: Thursday, June 13, 2024 2:14 PM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
@palmcorp https://github.com/palmcorp hi Paul,
Thank you for sharing the Colab notebook and the data5.yaml file. Let's dive into the issue and work towards a solution.
Key Points to Address
Keypoint Shape Mismatch: Your data5.yaml specifies kpt_shape: [5,2], which indicates 5 keypoints. However, if your dataset actually contains 17 keypoints, you should update this to kpt_shape: [17,2].
Configuration File: Ensure that your yolov8n-pose.yaml configuration file aligns with the number of keypoints in your dataset. Hereβs an example configuration snippet:
kpt_shape: [17, 2] ...
Pretrained Model: If you are loading a pretrained model, ensure that it is compatible with your custom dataset configuration. If you suspect it might be causing issues, try training without loading the pretrained model to see if it resolves the problem.
Next Steps
kpt_shape: [17, 2] # number of keypoints, number of dimensions
pip install --upgrade torch ultralytics hub-sdk
Example Code
Hereβs a simplified example of how your yolov8n-pose.yaml might look:
kpt_shape: [17, 2] ...
Additional Resources
If you continue to face issues, please share the specific error messages and any additional context that might help us diagnose the problem. This will help us provide more targeted assistance.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2166806093 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FQZN6B2DWUYPS7HVQ3ZHIDSBAVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRWHAYDMMBZGM . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FWMY2VCGM2B2WFN7V3ZHIDSBA5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBE3LE2.gif Message ID: @.***>
Hi Paul,
Thank you for the detailed update and for sharing your code and console output. Let's work through this step-by-step to identify and resolve the issue.
data.yaml
to data17.yaml
. Ensure that kpt_shape
in data17.yaml
correctly reflects the number of keypoints in your dataset.IndexError: list index out of range
, which suggests there might be a mismatch in the expected input dimensions or configurations.Verify data17.yaml
Configuration:
Ensure that data17.yaml
has the correct kpt_shape
parameter:
kpt_shape: [17, 2] # number of keypoints, number of dimensions
Check Model Configuration:
Make sure your yolov8n-pose.yaml
file aligns with the data17.yaml
configuration. Hereβs an example snippet:
# YOLOv8n-pose model configuration
kpt_shape: [17, 2]
...
Update and Verify Package Versions:
Ensure you are using the latest versions of torch
, ultralytics
, and hub-sdk
. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Simplify Model Loading: Simplify your model loading function to isolate the issue. Hereβs a revised version:
from ultralytics import YOLO
def POSE_LOAD(data_yaml_path):
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
print("short start with Paula")
Data_Yaml_Path = "/content/yaml_files/data17.yaml"
if not os.path.isfile(Data_Yaml_Path):
raise FileNotFoundError(f"{Data_Yaml_Path} not found")
model = POSE_LOAD(Data_Yaml_Path)
Run the Notebook: After making the above changes, run your Colab notebook again to see if the issue persists.
If the issue persists, please provide the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
Hi Paula,
Is it correct that kpt_shape: [17, 2] appears in multiple .yaml files? Iβll check to confirm that we are consistent. Will also --upgrade torch ultralytics hub-sdk in every notebook.
Thanks
Paul
From: Paula Derrenger @.*** Sent: Friday, June 14, 2024 1:02 AM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hi Paul,
Thank you for the detailed update and for sharing your code and console output. Let's work through this step-by-step to identify and resolve the issue.
Key Observations
Steps to Resolve
kpt_shape: [17, 2] # number of keypoints, number of dimensions
Check Model Configuration: Make sure your yolov8n-pose.yaml file aligns with the data17.yaml configuration. Hereβs an example snippet:
kpt_shape: [17, 2] ...
Update and Verify Package Versions: Ensure you are using the latest versions of torch, ultralytics, and hub-sdk. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Simplify Model Loading: Simplify your model loading function to isolate the issue. Hereβs a revised version:
from ultralytics import YOLO
def POSE_LOAD(data_yaml_path):
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
13.print("short start with Paula") 14.Data_Yaml_Path = "/content/yaml_files/data17.yaml"
16.if not os.path.isfile(Data_Yaml_Path):
raise FileNotFoundError(f"{Data_Yaml_Path} not found")
model = POSE_LOAD(Data_Yaml_Path)
Run the Notebook: After making the above changes, run your Colab notebook again to see if the issue persists.
Additional Debugging
If the issue persists, please provide the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2167474193 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FWTH4X6QPDBXYS33FLZHKPQBAVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRXGQ3TIMJZGM . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FT6GBALUP3LTQEC4JTZHKPQBA5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBGEEBC.gif Message ID: @.***>
Hi Paul,
Thank you for your proactive approach! Yes, it is crucial that the kpt_shape: [17, 2]
parameter is consistent across all relevant .yaml
files to avoid any configuration mismatches. Ensuring uniformity in these settings will help prevent errors related to keypoint dimensions.
Consistency Check:
Verify that kpt_shape: [17, 2]
is consistently set in all your configuration files, including data17.yaml
and yolov8n-pose.yaml
.
Package Upgrades:
Upgrading torch
, ultralytics
, and hub-sdk
in every notebook is a great step. You can do this with:
pip install --upgrade torch ultralytics hub-sdk
Simplified Model Loading: Ensure your model loading function is straightforward to isolate any potential issues. Hereβs a reminder of the simplified function:
from ultralytics import YOLO
def POSE_LOAD(data_yaml_path):
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
print("short start with Paula")
Data_Yaml_Path = "/content/yaml_files/data17.yaml"
if not os.path.isfile(Data_Yaml_Path):
raise FileNotFoundError(f"{Data_Yaml_Path} not found")
model = POSE_LOAD(Data_Yaml_Path)
If the issue persists after these steps, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
Hello Paula,
Now this is confusing. I substituted COCO images + labels for mine in the test and still get the following errors:
Freezing layer 'model.22.dfl.conv.weight'
train: Scanning /content/datasets/echo-pose/labels/train... 2 images, 0 backgrounds, 2 corrupt: 100%|ββββββββββ| 2/2 [00:00<00:00, 114.30it/s]
train: WARNING β οΈ /content/datasets/echo-pose/images/train/000000000001.jpg: ignoring corrupt image/label: labels require 39 columns each
I put a copy on Github if you want to look at it LMK.
Here are the code snippits again:
Also noticed some overload: (what determines the number of channels? (nc=5)?)
Overriding model.yaml kpt_shape=[17, 3] with kpt_shape=[17, 2]
Overriding model.yaml nc=1 with nc=5
print ("Model Steps : load/train/recognize ")
def POSE_LOAD(data_yaml_path):
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
def POSE_TRAIN(model, model_yaml_path):
model.train(data=model_yaml_path, epochs=EPOCHS, imgsz=640)
return model
def POSE_VAL(best_path):
if best_path == None:
model = YOLO('yolov8n-pose.pt')
metrics =2
else:
model = YOLO(best_path)
# Validate the model
metrics = model.val(data=best_path) # no arguments needed, dataset and settings remembered
metrics.box.map # map50-95
metrics.box.map50 # map50
metrics.box.map75 # map75
metrics.box.maps
return metrics
Downloading https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n-pose.pt to 'yolov8n-pose.pt'...
100%|ββββββββββ| 6.51M/6.51M [00:00<00:00, 67.7MB/s]
Transferred 397/397 items from pretrained weights
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
File "/usr/lib/python3.10/bdb.py", line 336, in set_trace
sys.settrace(self.trace_dispatch)
--Return--
None
(7) () |
5 pdb.set_trace()
6 model=POSE_LOAD (Data_Yaml_Path)
----> 7 pdb.set_trace()
8
9 #Model_Yaml_Path =os.path.join (PROJ_BASE,YAML_DIR,YOLO17)
ipdb> print Data_Yaml_Path)
*** SyntaxError: unmatched ')'
ipdb> print (Data_Yaml_Path)
/content/yaml_files/dataP17.yaml
ipdb> l
2 #Data_Yaml_Path = os.path.join (PROJ_BASE,YAML_DIR, DATA17)
3 Data_Yaml_Path = os.path.join (PROJ_BASE,YAML_DIR, DATA17P)
4 if not os.path.isfile(Data_Yaml_Path):
5 pdb.set_trace()
6 model=POSE_LOAD (Data_Yaml_Path)
----> 7 pdb.set_trace()
8
9 #Model_Yaml_Path =os.path.join (PROJ_BASE,YAML_DIR,YOLO17)
10 Model_Yaml_Path =os.path.join ("/content/yaml_files/dataP17.yaml")
11 if not os.path.isfile(Model_Yaml_Path):
12 pdb.set_trace()
ipdb> c
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
File "/usr/lib/python3.10/bdb.py", line 347, in set_continue
sys.settrace(None)
Ultralytics YOLOv8.2.32 π Python-3.10.12 torch-2.3.0+cu121 CPU (Intel Xeon 2.20GHz)
engine/trainer: task=pose, mode=train, model=yolov8n-pose.yaml, data=/content/yaml_files/dataP17.yaml, epochs=2, time=None, patience=100, batch=16, imgsz=640, save=True, save_period=-1, cache=False, device=None, workers=8, project=None, name=train, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=False, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, bgr=0.0, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs/pose/train
Downloading https://ultralytics.com/assets/Arial.ttf to '/root/.config/Ultralytics/Arial.ttf'...
100%|ββββββββββ| 755k/755k [00:00<00:00, 14.6MB/s]
Overriding model.yaml kpt_shape=[17, 3] with kpt_shape=[17, 2]
Overriding model.yaml nc=1 with nc=5
from n params module arguments
0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
1 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
2 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
3 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
4 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
5 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2]
6 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
7 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2]
8 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
9 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1]
12 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1]
15 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
16 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1]
18 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
19 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
21 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1]
22 [15, 18, 21] 1 924565 ultralytics.nn.modules.head.Pose [5, [17, 2], [64, 128, 256]]
YOLOv8n-pose summary: 250 layers, 3184101 parameters, 3184085 gradients, 8.8 GFLOPs
Transferred 355/397 items from pretrained weights
TensorBoard: Start with 'tensorboard --logdir runs/pose/train', view at http://localhost:6006/
Freezing layer 'model.22.dfl.conv.weight'
train: Scanning /content/datasets/echo-pose/labels/train... 2 images, 0 backgrounds, 2 corrupt: 100%|ββββββββββ| 2/2 [00:00<00:00, 114.30it/s]
train: WARNING β οΈ /content/datasets/echo-pose/images/train/000000000001.jpg: ignoring corrupt image/label: labels require 39 columns each
train: WARNING β οΈ /content/datasets/echo-pose/images/train/000000000016.jpg: ignoring corrupt image/label: labels require 39 columns each
train: New cache created: /content/datasets/echo-pose/labels/train.cache
WARNING β οΈ No images found in /content/datasets/echo-pose/labels/train.cache, training may not work correctly. See https://docs.ultralytics.com/datasets for dataset formatting guidance.
ValueError Traceback (most recent call last)
https://localhost:8080/
11 if not os.path.isfile(Model_Yaml_Path):
12 pdb.set_trace()
---> 13 POSE_TRAIN (model,Data_Yaml_Path)
10 frames
https://localhost:8080/
13
14 def POSE_TRAIN(model, model_yaml_path):
---> 15 model.train(data=model_yaml_path, epochs=EPOCHS, imgsz=640)
16 return model
17
/usr/local/lib/python3.10/dist-packages/ultralytics/engine/model.py https://localhost:8080/ in train(self, trainer, **kwargs)
672
673 self.trainer.hub_session = self.session # attach optional HUB session
--> 674 self.trainer.train()
675 # Update model and cfg after training
676 if RANK in {-1, 0}:
/usr/local/lib/python3.10/dist-packages/ultralytics/engine/trainer.py https://localhost:8080/ in train(self)
197
198 else:
--> 199 self._do_train(world_size)
200
201 def _setup_scheduler(self):
/usr/local/lib/python3.10/dist-packages/ultralytics/engine/trainer.py https://localhost:8080/ in _do_train(self, world_size)
316 if world_size > 1:
317 self._setup_ddp(world_size)
--> 318 self._setup_train(world_size)
319
320 nb = len(self.train_loader) # number of batches
/usr/local/lib/python3.10/dist-packages/ultralytics/engine/trainer.py https://localhost:8080/ in _setup_train(self, world_size)
280 # Dataloaders
281 batch_size = self.batch_size // max(world_size, 1)
--> 282 self.train_loader = self.get_dataloader(self.trainset, batch_size=batch_size, rank=RANK, mode="train")
283 if RANK in {-1, 0}:
284 # Note: When training DOTA dataset, double batch size could get OOM on images with >2000 objects.
/usr/local/lib/python3.10/dist-packages/ultralytics/models/yolo/detect/train.py https://localhost:8080/ in get_dataloader(self, dataset_path, batch_size, rank, mode)
47 assert mode in {"train", "val"}, f"Mode must be 'train' or 'val', not {mode}."
48 with torch_distributed_zero_first(rank): # init dataset *.cache only once if DDP
---> 49 dataset = self.build_dataset(dataset_path, mode, batch_size)
50 shuffle = mode == "train"
51 if getattr(dataset, "rect", False) and shuffle:
/usr/local/lib/python3.10/dist-packages/ultralytics/models/yolo/detect/train.py https://localhost:8080/ in build_dataset(self, img_path, mode, batch)
41 """
42 gs = max(int(de_parallel(self.model).stride.max() if self.model else 0), 32)
---> 43 return build_yolo_dataset(self.args, img_path, batch, self.data, mode=mode, rect=mode == "val", stride=gs)
44
45 def get_dataloader(self, dataset_path, batch_size=16, rank=0, mode="train"):
/usr/local/lib/python3.10/dist-packages/ultralytics/data/build.py https://localhost:8080/ in build_yolo_dataset(cfg, img_path, batch, data, mode, rect, stride, multi_modal)
85 """Build YOLO Dataset."""
86 dataset = YOLOMultiModalDataset if multi_modal else YOLODataset
---> 87 return dataset(
88 img_path=img_path,
89 imgsz=cfg.imgsz,
/usr/local/lib/python3.10/dist-packages/ultralytics/data/dataset.py https://localhost:8080/ in init(self, data, task, *args, **kwargs)
62 self.data = data
63 assert not (self.use_segments and self.use_keypoints), "Can not use both segments and keypoints."
---> 64 super().init(*args, **kwargs)
65
66 def cache_labels(self, path=Path("./labels.cache")):
/usr/local/lib/python3.10/dist-packages/ultralytics/data/base.py https://localhost:8080/ in init(self, img_path, imgsz, cache, augment, hyp, prefix, rect, batch_size, stride, pad, single_cls, classes, fraction)
72 self.fraction = fraction
73 self.im_files = self.get_img_files(self.img_path)
---> 74 self.labels = self.get_labels()
75 self.update_labels(include_class=classes) # single_cls and include_class
76 self.ni = len(self.labels) # number of images
/usr/local/lib/python3.10/dist-packages/ultralytics/data/dataset.py https://localhost:8080/ in get_labels(self)
159 # Check if the dataset is all boxes or all segments
160 lengths = ((len(lb["cls"]), len(lb["bboxes"]), len(lb["segments"])) for lb in labels)
--> 161 len_cls, len_boxes, len_segments = (sum(x) for x in zip(*lengths))
162 if len_segments and len_boxes != len_segments:
163 LOGGER.warning(
ValueError: not enough values to unpack (expected 3, got 0)
From: Paula Derrenger @.*** Sent: Friday, June 14, 2024 3:00 PM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hi Paul,
Thank you for your proactive approach! Yes, it is crucial that the kpt_shape: [17, 2] parameter is consistent across all relevant .yaml files to avoid any configuration mismatches. Ensuring uniformity in these settings will help prevent errors related to keypoint dimensions.
Steps to Follow
Consistency Check: Verify that kpt_shape: [17, 2] is consistently set in all your configuration files, including data17.yaml and yolov8n-pose.yaml.
Package Upgrades: Upgrading torch, ultralytics, and hub-sdk in every notebook is a great step. You can do this with:
pip install --upgrade torch ultralytics hub-sdk
Simplified Model Loading: Ensure your model loading function is straightforward to isolate any potential issues. Hereβs a reminder of the simplified function:
from ultralytics import YOLO
def POSE_LOAD(data_yaml_path):
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
10.print("short start with Paula") 11.Data_Yaml_Path = "/content/yaml_files/data17.yaml"
13.if not os.path.isfile(Data_Yaml_Path):
raise FileNotFoundError(f"{Data_Yaml_Path} not found")
model = POSE_LOAD(Data_Yaml_Path)
Additional Debugging
If the issue persists after these steps, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2168816388 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FTYPRIRZHGAS3U24OLZHNRWBAVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRYHAYTMMZYHA . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FRRPAWDXQ5COL42PATZHNRWBA5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBIWBQI.gif Message ID: @.***>
Hi Paul,
Thank you for your detailed message and for sharing the code snippets and error logs. Let's address the issues step-by-step to help you resolve them.
Corrupt Images/Labels: The warning indicates that your labels require 39 columns each, but the provided labels do not meet this requirement. This discrepancy is likely causing the training to fail.
Configuration Consistency:
Ensure that kpt_shape: [17, 2]
is consistently set in all relevant .yaml
files, including data17.yaml
and yolov8n-pose.yaml
.
Package Upgrades:
Make sure you are using the latest versions of torch
, ultralytics
, and hub-sdk
. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Simplified Model Loading: Simplify your model loading function to isolate the issue. Hereβs a revised version:
from ultralytics import YOLO
def POSE_LOAD():
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
print("short start with Paula")
model = POSE_LOAD()
Hereβs a small script to verify the format of your label files:
import os
def verify_labels(label_dir, expected_columns=39):
for label_file in os.listdir(label_dir):
if label_file.endswith('.txt'):
with open(os.path.join(label_dir, label_file), 'r') as f:
for line in f:
columns = line.strip().split()
if len(columns) != expected_columns:
print(f"Label file {label_file} has {len(columns)} columns, expected {expected_columns} columns.")
return False
return True
label_dir = '/content/datasets/echo-pose/labels/train'
if verify_labels(label_dir):
print("All label files are correctly formatted.")
else:
print("Some label files are incorrectly formatted.")
kpt_shape: [17, 2]
is consistent across all relevant .yaml
files.torch
, ultralytics
, and hub-sdk
to the latest versions.If the issue persists, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
Hi Paula,
Thanks for your persistence and help.
The images and labels were extracted from a running COCO project like the following:
https://docs.deci.ai/super-gradients/latest/YOLONAS-POSE.html
https://github.com/ultralytics/ultralytics/issues/1915
https://www.youtube.com/watch?v=m9fH9OWn8YM
So the label & image should be correct and yet they are being rejected. Check out the enclosed.
There has to be some configuration problem but it is not visible to me.
LMK if you see any logic bugs or can point me to some use cases.
Best,
Paul
From: Paula Derrenger @.*** Sent: Saturday, June 15, 2024 7:02 PM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hi Paul,
Thank you for your detailed message and for sharing the code snippets and error logs. Let's address the issues step-by-step to help you resolve them.
Key Observations and Steps to Resolve
Configuration Consistency: Ensure that kpt_shape: [17, 2] is consistently set in all relevant .yaml files, including data17.yaml and yolov8n-pose.yaml.
Package Upgrades: Make sure you are using the latest versions of torch, ultralytics, and hub-sdk. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Simplified Model Loading: Simplify your model loading function to isolate the issue. Hereβs a revised version:
from ultralytics import YOLO
def POSE_LOAD():
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
11.print("short start with Paula") model = POSE_LOAD()
Example Code for Label Verification
Hereβs a small script to verify the format of your label files:
import os
def verify_labels(label_dir, expected_columns=39): for label_file in os.listdir(label_dir): if label_file.endswith('.txt'): with open(os.path.join(label_dir, label_file), 'r') as f: for line in f: columns = line.strip().split() if len(columns) != expected_columns: print(f"Label file {label_file} has {len(columns)} columns, expected {expected_columns} columns.") return False return True
label_dir = '/content/datasets/echo-pose/labels/train' if verify_labels(label_dir): print("All label files are correctly formatted.") else: print("Some label files are incorrectly formatted.")
Next Steps
If the issue persists, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2171011174 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FXOFH57YUDTRGBDLH3ZHTWZ7AVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZRGAYTCMJXGQ . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FVF4FYGG4XS5KK2C2TZHTWZ7A5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBM4AGM.gif Message ID: @.***>
0 0.666952 0.484420 0.666096 0.766320 0.552553 0.210000 2.000000 0.585586 0.194000 2.000000 0.525526 0.188000 2.000000 0.000000 0.000000 0.000000 0.477477 0.194000 2.000000 0.717718 0.350000 2.000000 0.393393 0.372000 2.000000 0.762763 0.490000 2.000000 0.402402 0.522000 1.000000 0.645646 0.546000 2.000000 0.000000 0.000000 0.000000 0.717718 0.608000 2.000000 0.513514 0.620000 2.000000 0.963964 0.694000 2.000000 0.780781 0.744000 2.000000 0.000000 0.000000 0.000000 0.453453 0.778000 1.000000
0 0.671279 0.617945 0.645759 0.726859 0.519751 0.381250 2.000000 0.550936 0.348438 2.000000 0.488565 0.367188 2.000000 0.642412 0.354687 2.000000 0.488565 0.395313 2.000000 0.738046 0.526563 2.000000 0.446985 0.534375 2.000000 0.846154 0.771875 2.000000 0.442827 0.812500 2.000000 0.925156 0.964063 2.000000 0.507277 0.698438 2.000000 0.702703 0.942187 2.000000 0.555094 0.950000 2.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
Hi Paul,
Thank you for your persistence and for providing additional context. Let's work through this together to identify and resolve the issue.
Label Format: The error message indicates that your labels require 39 columns each, but the provided labels do not meet this requirement. For pose estimation with 17 keypoints, each label should have 1 class column + 17 keypoints * 2 (x, y coordinates) = 35 columns. It seems there might be a discrepancy here.
Configuration Consistency:
Ensure that kpt_shape: [17, 2]
is consistently set in all relevant .yaml
files, including data17.yaml
and yolov8n-pose.yaml
.
Package Versions:
Make sure you are using the latest versions of torch
, ultralytics
, and hub-sdk
. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Verify Label Format: Run the following script to ensure your label files are correctly formatted:
import os
def verify_labels(label_dir, expected_columns=35):
for label_file in os.listdir(label_dir):
if label_file.endswith('.txt'):
with open(os.path.join(label_dir, label_file), 'r') as f:
for line in f:
columns = line.strip().split()
if len(columns) != expected_columns:
print(f"Label file {label_file} has {len(columns)} columns, expected {expected_columns} columns.")
return False
return True
label_dir = '/content/datasets/echo-pose/labels/train'
if verify_labels(label_dir):
print("All label files are correctly formatted.")
else:
print("Some label files are incorrectly formatted.")
Consistency Check:
Ensure kpt_shape: [17, 2]
is consistent across all relevant .yaml
files.
Simplify Model Loading: Use the simplified model loading function provided earlier to isolate the issue:
from ultralytics import YOLO
def POSE_LOAD():
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
print("short start with Paula")
model = POSE_LOAD()
If the issue persists, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
Hi Peggy
Thinks again. Letβs look at the steps outlined.
For a limited run I ran 2 image and 2 labels . here is the breakdown of the first label 000000000001.txt (attached). I see class=0, bounding box = 0.666952 0.484420 0.666096 0.766320 followed by 17 2 keypoints. Where am I going wrong?
0
0.666952 0.484420 0.666096 0.766320
0.552553 0.210000 2.000000
0.585586 0.194000 2.000000
0.525526 0.188000 2.000000
0.000000 0.000000 0.000000
0.477477 0.194000 2.000000
0.717718 0.350000 2.000000
0.393393 0.372000 2.000000
0.762763 0.490000 2.000000
0.402402 0.522000 1.000000
0.645646 0.546000 2.000000
0.000000 0.000000 0.000000
0.717718 0.608000 2.000000
0.513514 0.620000 2.000000
0.963964 0.694000 2.000000
0.780781 0.744000 2.000000
0.000000 0.000000 0.000000
0.453453 0.778000 1.000000
Configuration Consistency
Following are the snippets from datap.yaml and yolovn-poseVp.yaml that deal with kpt_shape:
File: kpt_shape
dagaP17.yaml kpt_shape: [17,2] # number of keypoints, number of dim
yolov8n-poseVp.yaml kpt_shape: [17, 3]
I changed yolv8n-poseVp.yaml to [17.2]
pip install --upgrade torch ultralytics hub-sdk
IβM at a loss: here is the error report:
Attached are the yaml files and the first image & label? I donβt see the problem.
Ultralytics YOLOv8.2.32 π Python-3.10.12 torch-2.3.0+cu121 CPU (Intel Xeon 2.20GHz)
engine/trainer: task=pose, mode=train, model=yolov8n-pose.yaml, data=/content/yaml_files/yolov8n-poseVp.yaml, epochs=2, time=None, patience=100, batch=16, imgsz=640, save=True, save_period=-1, cache=False, device=None, workers=8, project=None, name=train, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=False, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, bgr=0.0, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs/pose/train
Downloading https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.ttf to '/root/.config/Ultralytics/Arial.ttf'...
100%|ββββββββββ| 755k/755k [00:00<00:00, 14.8MB/s]
Overriding model.yaml kpt_shape=[17, 3] with kpt_shape=[17, 2]
from n params module arguments
0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2]
1 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2]
2 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True]
3 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2]
4 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True]
5 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2]
6 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True]
7 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2]
8 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True]
9 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5]
10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1]
12 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1]
13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1]
15 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1]
16 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2]
17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1]
18 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1]
19 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2]
20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1]
21 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1]
22 [15, 18, 21] 1 923785 ultralytics.nn.modules.head.Pose [1, [17, 2], [64, 128, 256]]
YOLOv8n-pose summary: 250 layers, 3183321 parameters, 3183305 gradients, 8.8 GFLOPs
Transferred 361/397 items from pretrained weights
TensorBoard: Start with 'tensorboard --logdir runs/pose/train', view at http://localhost:6006/ http://localhost:6006/
Freezing layer 'model.22.dfl.conv.weight'
train: Scanning /content/datasets/echo-pose/labels/train... 2 images, 0 backgrounds, 2 corrupt: 100%|ββββββββββ| 2/2 [00:00<00:00, 85.21it/s]
train: WARNING β οΈ /content/datasets/echo-pose/images/train/000000000001.jpg: ignoring corrupt image/label: labels require 39 columns each
train: WARNING β οΈ /content/datasets/echo-pose/images/train/000000000016.jpg: ignoring corrupt image/label: labels require 39 columns each
train: New cache created: /content/datasets/echo-pose/labels/train.cache
WARNING β οΈ No images found in /content/datasets/echo-pose/labels/train.cache, training may not work correctly. See https://docs.ultralytics.com/datasets https://docs.ultralytics.com/datasets for dataset formatting guidance.
ValueError Traceback (most recent call last)
https://localhost:8080/
11 if not os.path.isfile(Model_Yaml_Path):
12 pdb.set_trace()
---> 13 POSE_TRAIN (model,Model_Yaml_Path)
10 frames
https://localhost:8080/ /usr/local/lib/python3.10/dist-packages/ultralytics/data/dataset.py in get_labels(self)
159 # Check if the dataset is all boxes or all segments
160 lengths = ((len(lb["cls"]), len(lb["bboxes"]), len(lb["segments"])) for lb in labels)
--> 161 len_cls, len_boxes, len_segments = (sum(x) for x in zip(*lengths))
162 if len_segments and len_boxes != len_segments:
163 LOGGER.warning(
ValueError: not enough values to unpack (expected 3, got 0)
Hi Paul,
Thank you for your persistence and for providing additional context. Let's work through this together to identify and resolve the issue.
Key Observations
Label Format: The error message indicates that your labels require 39 columns each, but the provided labels do not meet this requirement. For pose estimation with 17 keypoints, each label should have 1 class column + 17 keypoints * 2 (x, y coordinates) = 35 columns. It seems there might be a discrepancy here.
Configuration Consistency: Ensure that kpt_shape: [17, 2] is consistently set in all relevant .yaml files, including data17.yaml and yolov8n-pose.yaml.
Package Versions: Make sure you are using the latest versions of torch, ultralytics, and hub-sdk. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Steps to Resolve
Verify Label Format: Run the following script to ensure your label files are correctly formatted:
import os
def verify_labels(label_dir, expected_columns=35):
for label_file in os.listdir(label_dir):
if label_file.endswith('.txt'):
with open(os.path.join(label_dir, label_file), 'r') as f:
for line in f:
columns = line.strip().split()
if len(columns) != expected_columns:
print(f"Label file {label_file} has {len(columns)} columns, expected {expected_columns} columns.")
return False
return True
15.label_dir = '/content/datasets/echo-pose/labels/train' 16.if verify_labels(label_dir):
print("All label files are correctly formatted.") 18.else: print("Some label files are incorrectly formatted.")
Consistency Check: Ensure kpt_shape: [17, 2] is consistent across all relevant .yaml files.
Simplify Model Loading: Use the simplified model loading function provided earlier to isolate the issue:
21.from ultralytics import YOLO
23.def POSE_LOAD():
27.print("short start with Paula") model = POSE_LOAD()
Additional Debugging
If the issue persists, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2171270321 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FXANSDEJ7EJK3OFJO3ZHVHEVAVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZRGI3TAMZSGE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FVCIWJD3DY3F5MYUCLZHVHEVA5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBNL2LC.gif Message ID: @.***>
0 0.666952 0.484420 0.666096 0.766320 0.552553 0.210000 2.000000 0.585586 0.194000 2.000000 0.525526 0.188000 2.000000 0.000000 0.000000 0.000000 0.477477 0.194000 2.000000 0.717718 0.350000 2.000000 0.393393 0.372000 2.000000 0.762763 0.490000 2.000000 0.402402 0.522000 1.000000 0.645646 0.546000 2.000000 0.000000 0.000000 0.000000 0.717718 0.608000 2.000000 0.513514 0.620000 2.000000 0.963964 0.694000 2.000000 0.780781 0.744000 2.000000 0.000000 0.000000 0.000000 0.453453 0.778000 1.000000
Hi Paula,
Thanks for the verifier, great idea.
This version might work better. Added consideration for the
Best
Paul
= = = =
FROM="Paula email 6-16-24"
import os, pdb
VERSION= "0.2"
KEYSIZE=3 # FOR 2D keys, otherwie 4
def verify_labels(label_dir, expected_columns=35):
print ("chcking labels for: ", label_dir)
for label_file in os.listdir(label_dir):
if label_file.endswith('.txt'):
with open(os.path.join(label_dir, label_file), 'r') as f:
for line in f:
columns = line.strip().split()
print ("class= ", columns[0])
print ("B BOX= ", columns[1:5])
HEADER = 5
Nkeypoints =int (len(columns[5:len(columns)])/KEYSIZE)
if Nkeypoints != expected_columns:
print(f"Label file {label_file} has {len(columns)-HEADER} columns, expected {expected_columns} columns.")
return False
return True
print (" Label checker V", VERSION, " FROM: ", FROM, "\n")
label_dir=ld = '/content/datasets/echo-pose/labels/train'
if not os.path.exists (ld):
print (ld, "doesnt exist")
if verify_labels(label_dir):
print("All label files are correctly formatted.")
else:
print("Some label files are incorrectly formatted.")
From: Paula Derrenger @.*** Sent: Sunday, June 16, 2024 1:55 AM To: ultralytics/hub Cc: Paul Petronelli; Mention Subject: Re: [ultralytics/hub] 'yolov8n-pose.yaml' (Issue #721)
Hi Paul,
Thank you for your persistence and for providing additional context. Let's work through this together to identify and resolve the issue.
Key Observations
Label Format: The error message indicates that your labels require 39 columns each, but the provided labels do not meet this requirement. For pose estimation with 17 keypoints, each label should have 1 class column + 17 keypoints * 2 (x, y coordinates) = 35 columns. It seems there might be a discrepancy here.
Configuration Consistency: Ensure that kpt_shape: [17, 2] is consistently set in all relevant .yaml files, including data17.yaml and yolov8n-pose.yaml.
Package Versions: Make sure you are using the latest versions of torch, ultralytics, and hub-sdk. You can upgrade your packages using:
pip install --upgrade torch ultralytics hub-sdk
Steps to Resolve
Verify Label Format: Run the following script to ensure your label files are correctly formatted:
import os
def verify_labels(label_dir, expected_columns=35):
for label_file in os.listdir(label_dir):
if label_file.endswith('.txt'):
with open(os.path.join(label_dir, label_file), 'r') as f:
for line in f:
columns = line.strip().split()
if len(columns) != expected_columns:
print(f"Label file {label_file} has {len(columns)} columns, expected {expected_columns} columns.")
return False
return True
15.label_dir = '/content/datasets/echo-pose/labels/train' 16.if verify_labels(label_dir):
print("All label files are correctly formatted.") 18.else: print("Some label files are incorrectly formatted.")
Consistency Check: Ensure kpt_shape: [17, 2] is consistent across all relevant .yaml files.
Simplify Model Loading: Use the simplified model loading function provided earlier to isolate the issue:
21.from ultralytics import YOLO
23.def POSE_LOAD():
27.print("short start with Paula") model = POSE_LOAD()
Additional Debugging
If the issue persists, please share the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
β Reply to this email directly, view it on GitHub https://github.com/ultralytics/hub/issues/721#issuecomment-2171270321 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXH6FXANSDEJ7EJK3OFJO3ZHVHEVAVCNFSM6AAAAABJFEIHZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZRGI3TAMZSGE . You are receiving this because you were mentioned. https://github.com/notifications/beacon/ABXH6FVCIWJD3DY3F5MYUCLZHVHEVA5CNFSM6AAAAABJFEIHZKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUBNL2LC.gif Message ID: @.***>
Hi Paul,
Thank you for your continued efforts and for sharing the updated label verification script. It's great to see your proactive approach in refining the solution. Let's address the current situation and ensure we get everything working smoothly.
Label Format: Your label format seems correct with the class, bounding box, and keypoints. However, the error message indicates a requirement of 39 columns, which suggests there might be an additional dimension or configuration mismatch.
Configuration Consistency:
Ensuring kpt_shape: [17, 2]
is consistent across all relevant .yaml
files is crucial. It looks like you've already made this adjustment.
Package Versions: You've upgraded the packages, which is excellent. This ensures compatibility and access to the latest features and fixes.
Enhanced Label Verification Script: Your updated script is a good start. Hereβs a refined version that considers both 2D and 3D keypoints:
import os
VERSION = "0.2"
KEYSIZE = 3 # FOR 2D keys, otherwise 4
def verify_labels(label_dir, expected_columns=35):
print("Checking labels for:", label_dir)
for label_file in os.listdir(label_dir):
if label_file.endswith('.txt'):
with open(os.path.join(label_dir, label_file), 'r') as f:
for line in f:
columns = line.strip().split()
print("class=", columns[0])
print("B BOX=", columns[1:5])
HEADER = 5
Nkeypoints = int(len(columns[5:]) / KEYSIZE)
if Nkeypoints != expected_columns:
print(f"Label file {label_file} has {len(columns) - HEADER} columns, expected {expected_columns} columns.")
return False
return True
print("Label checker V", VERSION, "\n")
label_dir = '/content/datasets/echo-pose/labels/train'
if not os.path.exists(label_dir):
print(label_dir, "doesn't exist")
if verify_labels(label_dir):
print("All label files are correctly formatted.")
else:
print("Some label files are incorrectly formatted.")
Check for Additional Dimensions: Ensure that your labels and configuration files are not expecting an additional dimension (e.g., visibility or confidence score for each keypoint). This might explain the discrepancy in the expected number of columns.
Simplified Model Loading: Use the simplified model loading function to isolate the issue:
from ultralytics import YOLO
def POSE_LOAD():
model = YOLO('yolov8n-pose.yaml').load('yolov8n-pose.pt') # build from YAML and transfer weights
return model
print("short start with Paula")
model = POSE_LOAD()
If the issue persists, please provide the specific error messages and any additional context. This will help us diagnose the problem more effectively.
Thank you for your patience and cooperation. We're here to help you get this resolved! π
π Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO π and Vision AI β
Search before asking
Question
where can i download 'yolov8n-pose.yaml
Additional
No response