Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to improve the model for custom data #21

Open
sctrueew opened this issue Apr 21, 2020 · 30 comments
Open

How to improve the model for custom data #21

sctrueew opened this issue Apr 21, 2020 · 30 comments

Comments

@sctrueew
Copy link

@WongKinYiu Hi,

I have a problem that sometimes some pictures are not detected or detected wrong. I attached my model and some images for testing. Could you please check it and guide me? I have about 2K images per class. Please give me some information about the hyperparameters for my case.

file

Thanks in advance

Originally posted by @zpmmehrdad in #6 (comment)

@sctrueew
Copy link
Author

@WongKinYiu Hi,

Would you like me to give you my dataset?

Thanks

@WongKinYiu
Copy link
Owner

WongKinYiu commented Apr 23, 2020

hello,

i do not find the information about counters_per_class.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

You can remove "counters_per_class" from the file. @AlexeyAB Added this feature for balancing the dataset but I don't use that for this case. I add the repeated file to the train.txt for balancing.

@WongKinYiu
Copy link
Owner

oh, i just need the counter_per_class information for analyzing the reason.

could you calculate the anchors with letter box?

@sctrueew
Copy link
Author

oh, i just need the counter_per_class information for analyzing the reason.

I haven't trained the model with counter_per_class. You can remove the line.

could you calculate the anchors with letter box?
Yes, I can

Can I give you my small dataset?

@sctrueew
Copy link
Author

@WongKinYiu

The detection result is good but the classified result is not good.

@sctrueew
Copy link
Author

sctrueew commented Apr 23, 2020

@WongKinYiu Hi,

Could you please give me your email address to share the dataset?

Thanks in advance

@WongKinYiu
Copy link
Owner

image

@sctrueew
Copy link
Author

@WongKinYiu Hi,

I sent you an invitation link. I have a lot of classes that are the same and I want to select the best model and hyperparameters for this case. Thank you for helping

Thanks in advance

@sctrueew
Copy link
Author

@WongKinYiu Hi,

Did you see the dataset, How can I improve it?

Thanks

@WongKinYiu
Copy link
Owner

@zpmmehrdad

sorry for late reply.
yes, i downloaded the dataset.
i will take a look tonight.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

Thanks for the reply, I just wanted to say that I have a lot of sign which are the same. I opened an issue Link for example.

@WongKinYiu
Copy link
Owner

for traffic sign or licence plate or printed text, usually we use data synthesis with perspective effect for data augmentation.

but i think another problem of your dataset is height-width-ratio and small object, i will check it.

@WongKinYiu
Copy link
Owner

i think your objects are too small and too sparse.
and the dataset is consist of several groups of fine-grained classes
so

  1. anchors assignment should be modified
  2. maybe crop the image to make objects not so sparse
  3. maybe you can consider https://arxiv.org/abs/1902.07296 and data synthesis
  4. make it become multi-label problem

@sctrueew
Copy link
Author

I wanted to have different angles and backgrounds in the dataset. Does it need to resize the images before training?

i think your objects are too small and too sparse.
and the dataset is consist of several groups of fine-grained classes
so

  1. anchors assignment should be modified

How can I do that?

  1. maybe crop the image to make objects not so sparse

Should I do crop all of the images or add cropped images to the dataset?

  1. maybe you can consider https://arxiv.org/abs/1902.07296 and data synthesis
  1. make it become multi-label problem

Can you explain about it?

@sctrueew
Copy link
Author

@WongKinYiu Hi,

I always use this command for anchor :
darknet detector calc_anchors a.obj -num_of_clusters 9 -width 512 -height 512

Could you please more suggestions or give me the best CFG with hyperparameters?

Thanks

@WongKinYiu
Copy link
Owner

trythisfirst.txt

@sctrueew
Copy link
Author

trythisfirst.txt

@WongKinYiu Thanks for the reply,
What pre-trained should I use?

@WongKinYiu
Copy link
Owner

I do not change your backbone, so just use the command you used before for training.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

I trained a model on 6 classes that I shared the dataset to you but the result is not good. Classify is not a good result.

@WongKinYiu
Copy link
Owner

could you show the map results? thanks.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

I sent you an email. the mAP is on the training dataset, not test.

@WongKinYiu
Copy link
Owner

@zpmmehrdad Hello,

Please do not set batchsize=1 and subdivision=1, please use batchsize=64 and subdivision=64 instead. You can divide max_batches and steps by 64 to train same number of images.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

Yes, I'm using batch=64 and subdivision=32 for training and use 1 for testing.

@WongKinYiu
Copy link
Owner

WongKinYiu commented Apr 27, 2020

image
this case is really strange, do the wrong classify results are all 50 km peed limit?

@sctrueew
Copy link
Author

No, Sometimes some signs are detected wrong that not in the dataset.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

What do you think I remove the poor quality images from the dataset? because when the object is far, the result usually is wrong but when the object is near the result is good, of course not always

@WongKinYiu
Copy link
Owner

yes you can do that, but if there is an automatic method can enhance performance is better.
i think in your case softmax with cross entropy loss is better than binary cross entropy loss.

@sctrueew
Copy link
Author

@WongKinYiu Hi,

Could you please modify the CFG with softmax entropy loss?

@WongKinYiu
Copy link
Owner

hmm... i check the code, it seems https://github.com/AlexeyAB/darknet/blob/master/src/yolo_layer.c#L259 should be modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants