tensorflow / models

Models and examples built with TensorFlow
Other
77k stars 45.79k forks source link

Loss value not going below 1.2 for ssd mobilenet v2. #10688

Open AnishDeepak opened 2 years ago

AnishDeepak commented 2 years ago

I have been trying to implement an object detection model on my custom dataset which is having voco+weapons+own labeled. I have tried ssd mobilenetv2 model with default learning rate values and I also tried with 0.1, 0.01, 0.001, 0.05.. But the loss is not decreasing from 1.2. ssd mobilenetv2_coco_tf2.txt ssd_mobilenet_v2_coco_tf1.txt I have 14k images for train and 4600 images for testing.

Petros626 commented 2 years ago

I would let the learning rate as default for first time, but in my case its going to 0.xx. Dont know what could be the issue the maximum steps in the config file is 200.000. I've trained it about ~40k steps ;)

AnishDeepak commented 2 years ago

Hi, thanks for the response. ssd_mobilenet_fpnlite_v2_320 giving me upto .072% loss. My dataset contains voco images also, does it impact the model? because the model was already trained on coco.

On Sun, Jul 3, 2022 at 12:49 PM Petros626 @.***> wrote:

I would let the learning rate as default for first time, but in my case its going to 0.xx. Dont know what could be the issue the maximum steps in the config file is 200.000. I've trained it about ~40k steps ;)

— Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/10688#issuecomment-1173027585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOFJ6VZSPPXJLKE3EPNHUD3VSE5IJANCNFSM52IY72DA . You are receiving this because you authored the thread.Message ID: @.***>

--

-Anish Deepak

Petros626 commented 2 years ago

So it's not 1.2 like you mention? I think 0.72 (or 0.072?) is fine in relation to the recommended loss "under 2" for this network. To retrain your model to the trained pictures of the COCO dataset could be worse, I don't know exactly, but the normal case is to do transfer learning for a model.

AnishDeepak commented 2 years ago

So, shall I use the objects which are not in coco dataset. Will it give better results?

On Mon, 4 Jul, 2022, 10:23 am Petros626, @.***> wrote:

So it's not 1.2 like you mention? I think 0.72 (or 0.072?) is fine in relation to the recommended loss "under 2" for this network. To retrain your model to the trained pictures of the COCO dataset could be worse, I don't know exactly, but the normal case is to do transfer learning for a model.

— Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/10688#issuecomment-1173345285, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOFJ6V6HLISLDZH36UK63ETVSJU6FANCNFSM52IY72DA . You are receiving this because you authored the thread.Message ID: @.***>

Petros626 commented 2 years ago

Could be, it's just a guess.

Annieliaquat commented 2 years ago

I have been trying to implement an object detection model on my custom dataset which is having voco+weapons+own labeled. I have tried ssd mobilenetv2 model with default learning rate values and I also tried with 0.1, 0.01, 0.001, 0.05.. But the loss is not decreasing from 1.2. ssd mobilenetv2_coco_tf2.txt ssd_mobilenet_v2_coco_tf1.txt I have 14k images for train and 4600 images for testing.

Hey.. my model has also the same issue. The loss is not going down then 2. Did you do something else. Also I want to find the confusion matrix after training my mode. so is there a way to find confusion matrix in mobilenet_ssd??

Annieliaquat commented 2 years ago

So it's not 1.2 like you mention? I think 0.72 (or 0.072?) is fine in relation to the recommended loss "under 2" for this network. To retrain your model to the trained pictures of the COCO dataset could be worse, I don't know exactly, but the normal case is to do transfer learning for a model.

Hey.. my model has also the same issue. The loss is not going down then 2. Did you do something else. Also I want to find the confusion matrix after training my mode. so is there a way to find confusion matrix in mobilenet_ssd??

AnishDeepak commented 2 years ago

I have tried efficientDet d0 model and got loss=0.32, of course the model has larger size and slow compared to the mobilenet. But I preferred the efficientdet because of its mAP. Efficientdet using 'swift' activation function so I am trying to use different activation functions in mobilent. If I get any improvement, I will share my config file. Mobilenet gave me the loss=0.95 after removed the voco images.

Annieliaquat commented 2 years ago

I have tried efficientDet d0 model and got loss=0.32, of course the model has larger size and slow compared to the mobilenet. But I preferred the efficientdet because of its mAP. Efficientdet using 'swift' activation function so I am trying to use different activation functions in mobilent. If I get any improvement, I will share my config file. Mobilenet gave me the loss=0.95 after removed the voco images.

When I was training for 3000 steps it was giving me 0.21 but now when I train the loss was first 2 and then I removed all the checpoints and trained again the loss is 0.28 , even if I train for 6000 steps it doesnot goes down anymore

Petros626 commented 2 years ago

@AnishDeepak forgot to tell you that a constant loss under 2 is fine for the ssd_mobilenet (https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10#6-run-the-training), but I dont know where he gets this information. I didn't found something about it in past research.