Open nicewiz opened 2 years ago
btw please tell me if you need more details, I'll response as soon as possible.
I have also trained my custom dataset with yolo-pose, maybe we can share the training process. If you change the number of key points, there are several changes to the source code
@zengyao1999
Glad to see your reply and share my training process with you, As my dataset format is same as coco->yolo format, I did only update almost all params related to number of keypoints such as list or tensor shape but obviously it didn't work.
Unfortunately, some mistakes happened to my remote server so that I can't reproduce problems I have met. I will share my training process and some prediction examples here for further discussion after the server is fixed.
Could you please give me some tips I may miss in training and modifying? I am debugging with a single-image dataset on my PC and no more progress have been made now.
Thanks again!
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
@zengyao1999 Thanks for your advice!
I guess the labels in my single-class dataset are OK because I checked the training_batch*.jpg where keypoints and skeletons were correctly visualized. Btw I tried yolor-pose contributed by the author of yolov7 but the problem remained.
Sorry I can't give you more details today as my server wasn't fixed yet, I will show more error infos as soon as server works.
Thanks again
@nicewiz How do you set the sigmas parameter for object keypoints similarity, is it custom? Or try to modify the formula of oks,like this ,in addition you can also see if the predicted results are correct
@zengyao1999 Great thanks!
I have checked the predicted results after training before the server didn't work, it's interesting to find that some points(1 or 2/12) were predicted correctly while other points not. These points usually locates in center of person, like head center and body center. This might be some hints to problem and I am checking and anaylzing it.
I did notice I have to update the sigmas for severe self-occlusion in my datasets. But it was hard to calculate a correct sigma so I updated them based on annotation experience. I will add training with different sigmas in my TODO list!
@nicewiz Halo, could you share the modified coding files for custom dataset training? Thanks a lot!
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
嗨,你好,我也想修改yolo pose用于自己的多类别任务,我修改了label,loss,等等,代码正常跑起来了,但是完全无法收敛,单类别的时候bbox Ap正常,但是一旦变为多类别,就完全检测不到任何东西,请问您有什么好的建议吗
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
嗨,你好,我也想修改yolo pose用于自己的多类别任务,我修改了label,loss,等等,代码正常跑起来了,但是完全无法收敛,单类别的时候bbox Ap正常,但是一旦变为多类别,就完全检测不到任何东西,请问您有什么好的建议吗
你好,可以了解下你训练多类别任务时还是保持同样的关键点数量吗?
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
嗨,你好,我也想修改yolo pose用于自己的多类别任务,我修改了label,loss,等等,代码正常跑起来了,但是完全无法收敛,单类别的时候bbox Ap正常,但是一旦变为多类别,就完全检测不到任何东西,请问您有什么好的建议吗
你好,可以了解下你训练多类别任务时还是保持同样的关键点数量吗?
是的,我是用coco关键点标注方式,只是将txt文件第一列改为【0,9】,而不是只有一类0,关键点17个点 具体的格式如yolopose论文的示例
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
嗨,你好,我也想修改yolo pose用于自己的多类别任务,我修改了label,loss,等等,代码正常跑起来了,但是完全无法收敛,单类别的时候bbox Ap正常,但是一旦变为多类别,就完全检测不到任何东西,请问您有什么好的建议吗
I didn't do any multi-class detection so I have no idea about your problem.
In my custom dataset, I found the convergence problem usually happened when I was training with less than 5k images. The same question can be reproduced on coco dataset.
You can try to train your model with part of labels (upper 13 kpts instead of whole 17 kpts) and same number of images of your dataset in coco dataset to check your pipeline. It really helps my work and hopes to help you too.
@Bin-ze txt文件第一列应该是要放class的数量,这样的话,你要放nc: 10 (根据你给的【0, 9】)
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
嗨,你好,我也想修改yolo pose用于自己的多类别任务,我修改了label,loss,等等,代码正常跑起来了,但是完全无法收敛,单类别的时候bbox Ap正常,但是一旦变为多类别,就完全检测不到任何东西,请问您有什么好的建议吗
训练多类别的话,yolo.py里的Detect类需要改一下
Hi, could anyone tell me how should I convert coco keypoints format to yolo format? What should the files in the datasets/labels
folder be?
coco keypoints label have yolo verion ,you can refer to it and write code modification.
发自我的iPhone
在 2022年9月4日,23:57,tctco @.***> 写道:
Hi, could anyone tell me how should I convert coco keypoints format to yolo format? What should the files in the datasets/labels folder be?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
@zengyao1999 Great thanks!
I have checked the predicted results after training before the server didn't work, it's interesting to find that some points(1 or 2/12) were predicted correctly while other points not. These points usually locates in center of person, like head center and body center. This might be some hints to problem and I am checking and anaylzing it.
I did notice I have to update the sigmas for severe self-occlusion in my datasets. But it was hard to calculate a correct sigma so I updated them based on annotation experience. I will add training with different sigmas in my TODO list!
Have you solved this problem? How should I set the sigmas value when I train custom dataset(or how can I calculate it)? Looking forward to your reply.
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
嗨,你好,我也想修改yolo pose用于自己的多类别任务,我修改了label,loss,等等,代码正常跑起来了,但是完全无法收敛,单类别的时候bbox Ap正常,但是一旦变为多类别,就完全检测不到任何东西,请问您有什么好的建议吗
I didn't do any multi-class detection so I have no idea about your problem.
In my custom dataset, I found the convergence problem usually happened when I was training with less than 5k images. The same question can be reproduced on coco dataset.
You can try to train your model with part of labels (upper 13 kpts instead of whole 17 kpts) and same number of images of your dataset in coco dataset to check your pipeline. It really helps my work and hopes to help you too.
@nicewiz
Hi! I have stopped this project for some weeks and may not give you many advices.
I update my sigmas following the method in coco-wholebody paper: ask some annotators to annotate your data and calculate the mean and covarience of annotations. If you have no partners to do this, try to repeat annotating by yourself to obtain several acceptable annoatation to calculate may works.
btw I dont think sigmas really matters for this project in application unless they are set to unreasonable values. Just set them with origin value is acceptable (for me). Maybe you'd better pay more attention to diversity or size of your dataset.
Thanks again for your interests @Byronnar.
Thank you so much! I will check my dataset.
@nicewiz @Byronnar how did you create a custom dataset? Could you tell me what these numbers are in the coco dataset labels? I couldn't find it. Thanks in advance!
@nicewiz @Byronnar how did you create a custom dataset? Could you tell me what these numbers are in the coco dataset labels? I couldn't find it. Thanks in advance!
These data are converted from the coco dataset and normalized, you can refer to this part of the code:
Convert COCO format to x,y,w,h,x1,y1,v1...., then let label = [x,y,w,h,x1,y1,v1...]
For example:
label = [0.0, 162.3463687150837, 477.65363128491623, 408.6273749494417, 477.65363128491623, 444.7596251834387]
Then:
cx = (label[0] + label[2] / 2) / width # cx
cy = (label[1] + label[3] / 2) / height # cy
w = label[2] / width # w
h = label[3] / height # h
x1 = label[4] / width # l0_x
y1 = label[5] / height # l0_y
x2y2...
Follow these steps, you can get the train datasets.
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you
Great! The guide is helpful to me to train a custom dataset with 2 classes and 4 keypoints.
@lqian can you please explain ,how to build custom pose data? i want to do classification of yoga poses
Where is this part of the code please, I see that the coco2json URL provided by the author doesn't seem to be converted to kpt format
@nicewiz @Byronnar how did you create a custom dataset? Could you tell me what these numbers are in the coco dataset labels? I couldn't find it. Thanks in advance!
These data are converted from the coco dataset and normalized, you can refer to this part of the code:
Convert COCO format to x,y,w,h,x1,y1,v1...., then let label = [x,y,w,h,x1,y1,v1...] For example: label = [0.0, 162.3463687150837, 477.65363128491623, 408.6273749494417, 477.65363128491623, 444.7596251834387] Then: cx = (label[0] + label[2] / 2) / width # cx cy = (label[1] + label[3] / 2) / height # cy w = label[2] / width # w h = label[3] / height # h x1 = label[4] / width # l0_x y1 = label[5] / height # l0_y x2y2... Follow these steps, you can get the train datasets.
Do you need to write this script yourself? I see that the coco2yolo script provided by the author does not have a conversion to kpt format
https://github.com/Bin-ze/object_detection_tools_function/blob/main/json_to_yolopose.py 你可以参考,其实非常简单,只要三步,读取原始数据,数据格式化,输出格式化后的数据,没有难度,加油吧
发自我的iPhone
在 2022年11月29日,19:50,lary @.***> 写道:
Coco关键点标签有Yolo版本,你可以参考它并编写代码修改。 发自我的iPhone ... 在 2022年9月4日,23:57,tctco @.***> 写道: Hi, could anyone tell me how should I convert coco keypoints format to yolo format? What should the files in the datasets/labels folder be? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
请问你有写过这个脚本吗,我想要转换coco的test-dev标签,但是不知道怎么转换
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
https://github.com/Bin-ze/object_detection_tools_function/blob/main/json_to_yolopose.py 你可以参考,其实非常简单,只要三步,读取原始数据,数据格式化,输出格式化后的数据,没有难度,加油吧 发自我的iPhone … 在 2022年11月29日,19:50,lary @.> 写道: Coco关键点标签有Yolo版本,你可以参考它并编写代码修改。 发自我的iPhone ... 在 2022年9月4日,23:57,tctco @.> 写道: Hi, could anyone tell me how should I convert coco keypoints format to yolo format? What should the files in the datasets/labels folder be? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned. 请问你有写过这个脚本吗,我想要转换coco的test-dev标签,但是不知道怎么转换 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
感谢大佬,解决了
RectLabel is an offline image annotation tool for object detection and segmentation. With RectLabel, you can import the COCO keypoints format and export to the YOLO keypoints format.
class_index center_x center_y width height x1 y1 v1 x2 v2 y2 x3 y3 v3 ...
0 0.545230 0.616880 0.298794 0.766239 0.522073 0.309332 2 0.540170 0.293193 2 0.499589 0.296503 2 ...
A visibility flag v defined as v=0: not labeled (in which case x=y=0), v=1: labeled but not visible, and v=2: labeled and visible. https://cocodataset.org/#format-data
@zengyao1999 @nicewiz May you share you customized code? Would greatly appreciate it!
Hi! I'm trying to train on a custom dataset with 3 keypoints of a foot (heel, big toe, small toe). I'm making progress of changing all the places from 17 to 3 keypoints, but somehow my train_batches look bad and my net doesn't converge. Loss goes up instead of down... Or is this to be expected when there are keypoints with visibility flag == 0? In that case I'm putting in 0.0 for x and y.
You can see the problem in my screehsot.
@Jaykob how you did this? have you done annotation or using code?
I converted a COCO dataset using you're hints and changed all the instances of 17 kpts in the code (at least I hope so) at the places that were mentioned here.
@Jaykob i have to do for yoga poses, how should i do then? any idea?
RectLabel is an offline image annotation tool for object detection and segmentation. With RectLabel, you can import the COCO keypoints format and export to the YOLO keypoints format.
class_index center_x center_y width height x1 y1 v1 x2 v2 y2 x3 y3 v3 ... 0 0.545230 0.616880 0.298794 0.766239 0.522073 0.309332 2 0.540170 0.293193 2 0.499589 0.296503 2 ...
A visibility flag v defined as v=0: not labeled (in which case x=y=0), v=1: labeled but not visible, and v=2: labeled and visible. https://cocodataset.org/#format-data
@akashAD98
I guess, you can use this annotation tool to have a try to annotate
Thank you very much guys for your shared ideas !
@Jaykob , @Byronnar , @nicewiz
Have you solved the convergence issues?
I tried modifying sigmas, and used another loss function. It helped a bit, but maybe there's also additional ways?
Excuse me, I would like to ask where the source code should be modified to modify the number of key points (e.g. only detect the upper body, not the four points of the left and right knees and ankles). After modifying the key points in the source code, can I continue to use the original dataset containing 17 points, and look forward to your reply
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj
Check out this repo for YOLOv7 (he made everything convenient in terms of nkpt. Only place where hardcoded is plots.py): https://github.com/ruiz-manuel/yolov7-pose-custom
About the dataset, you can just remove the unnecessery points at the end of the txt label file (I just removed the last 7 points for the sake of the experiment, it worked)
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj
查看这个 YOLOv7 的存储库(他在 nkpt 方面使一切都变得方便。仅硬编码的地方是 plots.py):https://github.com/ruiz-manuel/yolov7-pose-custom
关于数据集,你可以删除txt标签文件末尾不必要的点(为了实验,我只是删除了最后7个点,
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj
查看这个 YOLOv7 的存储库(他在 nkpt 方面使一切都变得方便。仅硬编码的地方是 plots.py):https://github.com/ruiz-manuel/yolov7-pose-custom
关于数据集,你可以删除txt标签文件末尾不必要的点(为了实验,我只是删除了最后7个点,它奏效了)
感谢您的解答!但是我还有两个问题:1.删除数据集不需要的点是逐个手动删除标签吗?2.YOLOv7是修改关键点只需要修改plots.py里面的nkpt就可以吗
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj 查看这个 YOLOv7 的存储库(他在 nkpt 方面使一切都变得方便。仅硬编码的地方是 plots.py):https://github.com/ruiz-manuel/yolov7-pose-custom 关于数据集,你可以删除txt标签文件末尾不必要的点(为了实验,我只是删除了最后7个点,
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj 查看这个 YOLOv7 的存储库(他在 nkpt 方面使一切都变得方便。仅硬编码的地方是 plots.py):https://github.com/ruiz-manuel/yolov7-pose-custom 关于数据集,你可以删除txt标签文件末尾不必要的点(为了实验,我只是删除了最后7个点,它奏效了)
感谢您的解答!但是我还有两个问题:1.删除数据集不需要的点是逐个手动删除标签吗?2.YOLOv7是修改关键点只需要修改plots.py里面的nkpt就可以吗
One keypoint has 3 numbers in the txt file. I just removed the last 21 numbers (3 numbers * 7 keypoints). Hence, I removed last 7 keypoints, which are legs
I think, you need to compare original yolov7-pose and his repo to get the whole idea of where the changes are and how to make them. Generally, you need to modify his yaml files
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj 查看这个 YOLOv7 的存储库(他在 nkpt 方面使一切都变得方便。仅硬编码的地方是 plots.py):https://github.com/ruiz-manuel/yolov7-pose-custom 关于数据集,你可以删除txt标签文件末尾不必要的点(为了实验,我只是删除了最后7个点,
我还使用 yolo-pose 训练了我的自定义数据集,也许我们可以分享训练过程。如果更改关键点的数量,则对源代码进行了一些更改
打扰了,我想问一下修改关键点数量(例如只检测上半身,不检测左右膝盖和脚踝四个点)源代码应该修改哪些地方。还有修改了源代码中的关键点数后 可以还继续使用原来的包含17个点的数据集吗,十分期待您的回复
@LinXiaoj 查看这个 YOLOv7 的存储库(他在 nkpt 方面使一切都变得方便。仅硬编码的地方是 plots.py):https://github.com/ruiz-manuel/yolov7-pose-custom 关于数据集,你可以删除txt标签文件末尾不必要的点(为了实验,我只是删除了最后7个点,它奏效了)
感谢您的解答!但是我还有两个问题:1.删除数据集不需要的点是逐个手动删除标签吗?2.YOLOv7是修改关键点只需要修改 plots.py 里面的nkpt就可以吗
- 一个关键点在 txt 文件中有 3 个数字。我刚刚删除了最后 21 个数字(3 个数字 * 7 个关键点)。因此,我删除了最后 7 个关键点,即腿
- 我认为,您需要比较原始的yolov7-pose和他的存储库,以了解更改的位置以及如何进行更改。通常,您需要修改他的yaml文件
是需要编写脚本来删除每个数据集标签中的关键点吗?还有想删除腿部具体应该改yaml文件中的哪些地方
@LinXiaoj
I think yes , you need to write a script
You need to change nkpt and nc in yaml files
@LinXiaoj
我认为是的,你需要写一个脚本
您需要更改 yaml 文件中的 nkpt 和 nc
nc是指我要识别的动作类别的数量吗,改好数据集就只修改这两个参数后就可以重新训练了吗
@LinXiaoj
It refers to the number of classes you want to predict, like person, car, etc
@nomaad42 Not really... I kind of gave up on it as I didn't get satisfying results. I had much more success using the MMPose framework.
@Jaykob Got it, thanks for the ideas!
@nicewiz First make sure your input is OK, including boxes and keypoints, and if you are not a single-class, modify nc and any other parameters involved. I modified the same as you, mainly these parts: compute_loss, create_targets loss.py cache_labels datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py Then my dataset contains two classes, so I also modified the non-max suppression. You can send your question and maybe I can help you 你好,想问一下你修改好了以后在训练的时候有没有出现两个不同类别检测的时候出现检测框相互交叉的情况,而且检测框的准确性很低
Hello, may I ask how to extract the coordinate information of the key points of the human body and hand it over to the neural network for training, so as to classify and predict the actions of the human body through the actions represented by the key points?
Thanks for your great work!
I'm trying to retrain yolo-pose on my custom dataset with different keypoints num and same format, and I may further extend some segmentation module based on your work.
I first reproduce it on coco dataset and obtain reasonable inference result on my custom dataset. After that, I modified all nkpt setting I could find from 17(coco) to 12(custom) and training pipeline works. But I found the result is so terrible and the keypoint loss was always around 0.3 throughout 300 epochs. I tried overfitting in a single-image dataset but kpts loss is still high.
Could you please give some tips about how to fix this problem or some potential modification I may missed?
my modified list: compute_loss, create_targets in loss.py cache_labels in datasets.py Detect.forword in yolo.py nkpt in hub/model.yaml plots.py
hope for your reply @debapriyamaji