WongKinYiu / CrossStagePartialNetworks

Cross Stage Partial Networks
https://github.com/WongKinYiu/CrossStagePartialNetworks
894 stars 172 forks source link

How to improve the model for custom data #21

Open sctrueew opened 4 years ago

sctrueew commented 4 years ago

@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 https://github.com/WongKinYiu/CrossStagePartialNetworks/issues/6#issuecomment-616100822

sctrueew commented 4 years ago

@WongKinYiu Hi,

Would you like me to give you my dataset?

Thanks

WongKinYiu commented 4 years ago

hello,

i do not find the information about counters_per_class.

sctrueew commented 4 years ago

@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 commented 4 years ago

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

could you calculate the anchors with letter box?

sctrueew commented 4 years ago

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 commented 4 years ago

@WongKinYiu

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

sctrueew commented 4 years ago

@WongKinYiu Hi,

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

Thanks in advance

WongKinYiu commented 4 years ago

image

sctrueew commented 4 years ago

@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 commented 4 years ago

@WongKinYiu Hi,

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

Thanks

WongKinYiu commented 4 years ago

@zpmmehrdad

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

sctrueew commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

  2. make it become multi-label problem

Can you explain about it?

sctrueew commented 4 years ago

@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 commented 4 years ago

trythisfirst.txt

sctrueew commented 4 years ago

trythisfirst.txt

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

WongKinYiu commented 4 years ago

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

sctrueew commented 4 years ago

@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 commented 4 years ago

could you show the map results? thanks.

sctrueew commented 4 years ago

@WongKinYiu Hi,

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

WongKinYiu commented 4 years ago

@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 commented 4 years ago

@WongKinYiu Hi,

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

WongKinYiu commented 4 years ago

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

sctrueew commented 4 years ago

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

sctrueew commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

@WongKinYiu Hi,

Could you please modify the CFG with softmax entropy loss?

WongKinYiu commented 4 years ago

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