WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.98k stars 524 forks source link

How to train YoloR using only one class (e.g. person)? #118

Open smgrz opened 2 years ago

smgrz commented 2 years ago

Training works with only one class, but when I take the trained model in detect.py the class (e.g. person) is not recognized!

Do I need to change some parameters somewhere?

remtav commented 2 years ago

@smgrz see this answer: https://github.com/WongKinYiu/yolor/issues/103#issuecomment-927617539

Mobu59 commented 2 years ago

hi did you solve it successfully? Could you please help me to fix a problem?

remtav commented 2 years ago

@Mobu59 I solved the problem of training only one class by following the answer in https://github.com/WongKinYiu/yolor/issues/103#issuecomment-927617539. If that's your problem, that should do it.

Mobu59 commented 2 years ago

@Mobu59 I solved the problem of training only one class by following the answer in #103 (comment). If that's your problem, that should do it. I want to know what the format of the data set should be ,I make two folders: dataset/images/train, dataset/images/val,and put txts which including imgnames and xywh respectively,but when I train, cannot find dataset

remtav commented 2 years ago

Take a look at how coco's dataset is organized: https://cocodataset.org/#download I downloaded the val2017 images and labels and organized my dataset the same way. From root directory, it looks something like this:

58 0.389578 0.416103 0.038594 0.163146
62 0.127641 0.505153 0.233312 0.222700
62 0.934195 0.583462 0.127109 0.184812
56 0.604656 0.632547 0.087500 0.241385

Then train with the yaml pointing to your dataset txt files (the ones directly in your root). It should look something like this: https://github.com/WongKinYiu/yolor/blob/main/data/coco.yaml

Good luck!

Mobu59 commented 2 years ago

Take a look at how coco's dataset is organized: https://cocodataset.org/#download I downloaded the val2017 images and labels and organized my dataset the same way. From root directory, it looks something like this:

  • val2017.txt: list of paths to validation images
  • images/val2017: directory containing all images listed in txt file above
  • labels/val2017: directory containing list of txt files with the same name as images, but only with .txt extension rather than .jpg. These txt files are themselves a list of the class number with xywh. For example:
58 0.389578 0.416103 0.038594 0.163146
62 0.127641 0.505153 0.233312 0.222700
62 0.934195 0.583462 0.127109 0.184812
56 0.604656 0.632547 0.087500 0.241385

Then train with the yaml pointing to your dataset txt files (the ones directly in your root). It should look something like this: https://github.com/WongKinYiu/yolor/blob/main/data/coco.yaml

Good luck!

Thanks for your help!I‘ll try it tomorrow

soheilmajidi commented 2 years ago

is other loss function or activation function needed? or changing filters and classes to 18 and 1 is enough?