Sunday, 6 November 2022

Getting negative bounding box while loss is very small

Here is my code in a Google Colab that can be reproduced.

I create a synthetic data set of images with size 200x200 where a rhombus is present. A sample of my data is the following:

enter image description here

I have a label x,y, theta, s_x, s_y where x,ys are the coordinates of the center of rhombus, theta is the rotation angle of the rhombus, s_x, s_y are lengths of its diagonals. I am trying to train a neural network to predict the label of a rhombus. Notice that I cannot use line detector since there are random lines in images. I find the mean and standard deviation of my dataset and normalize the images to train the model. Here is the training loss after two epochs:

enter image description here

Problem

For some reason I get negative number for predicted label which cannot be true. I tried to have a ReLU after the last layer but it did not work.

Question

  1. How can I train a model that can predict the labels?
  2. Is my model wrong?
  3. What other models I can use to get it worked?

Reproducible code

Here is my code in a Google Colab that can be reproduced.



from Getting negative bounding box while loss is very small

No comments:

Post a Comment