You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried to detect a single class (car ) data in VOC format.
So I changed voc2012.names to single line to generate new tfrecord data:
"car"
And changed the flags define in train.py and detect.py like below:
" flags.DEFINE_integer('num_classes', 1, 'number of classes in the model')"
Training is ok, but when I use detect.py to inference,I got the answer like this:
"I0306 13:48:14.657661 140508698953536 detect.py:56] time: 7.611089706420898
I0306 13:48:14.658213 140508698953536 detect.py:58] detections:
I0306 13:48:14.672537 140508698953536 detect.py:62] car, 0.4999775290489197, [0.17678313 0.30110145 0.30877244 0.56212616]
I0306 13:48:14.676712 140508698953536 detect.py:62] car, 0.4999728798866272, [0.34846273 0.47863787 0.48382244 0.8014421 ]
I0306 13:48:14.681894 140508698953536 detect.py:62] car, 0.49983859062194824, [0.40488383 0.14127088 0.48221472 0.30515537]
I0306 13:48:14.686771 140508698953536 detect.py:62] car, 0.49938303232192993, [0.04897165 0.06757799 0.12495686 0.19713354]
I0306 13:48:14.691031 140508698953536 detect.py:62] car, 0.49914953112602234, [0.17951395 0.02865338 0.24622466 0.1438287 ]
"
Obviously, the bboxes are all ok, but the scores are all below 0.5, so I debug the code:
"scores = confidence * class_probs" in models.py
"confidence" is very much close to 1, but "class_probs" is below 0.5 all the way.
So I'm confused.Is there anything wrong with my test?I run this code in tensorflow==2.10 by PyCharm.Inference by pretrained coco weights is fine.
Any one can give some advise?
Thx a lot!
The text was updated successfully, but these errors were encountered:
If you are outputting 2 probabilities from your network can you try a softmax instead of sigmoid for your class_probs? Alternatively, return class_probs as logits(no activation function) from yolo_boxes and set from_logits=True in sparse_categorical_crossentropy. You will have to softmax your class output (o[2]) in yolo_nms if you choose to do the latter.
If you are outputting 2 probabilities from your network can you try a softmax instead of sigmoid for your class_probs? Alternatively, return class_probs as logits(no activation function) from yolo_boxes and set from_logits=True in sparse_categorical_crossentropy. You will have to softmax your class output (o[2]) in yolo_nms if you choose to do the latter.
ye,I tried to replace tf.sigmoid by tf.nn.softmax, I think it works well for both 1-class and 2-classes detection. But I guess softmax will decrase the class scores when detect a "multi-label" target, and will make FLAG "yolo_score_threshold" undecidable.
Hi,
I have tried to detect a single class (car ) data in VOC format.
So I changed voc2012.names to single line to generate new tfrecord data:
"car"
And changed the flags define in train.py and detect.py like below:
" flags.DEFINE_integer('num_classes', 1, 'number of classes in the model')"
Training is ok, but when I use detect.py to inference,I got the answer like this:
"I0306 13:48:14.657661 140508698953536 detect.py:56] time: 7.611089706420898
I0306 13:48:14.658213 140508698953536 detect.py:58] detections:
I0306 13:48:14.672537 140508698953536 detect.py:62] car, 0.4999775290489197, [0.17678313 0.30110145 0.30877244 0.56212616]
I0306 13:48:14.676712 140508698953536 detect.py:62] car, 0.4999728798866272, [0.34846273 0.47863787 0.48382244 0.8014421 ]
I0306 13:48:14.681894 140508698953536 detect.py:62] car, 0.49983859062194824, [0.40488383 0.14127088 0.48221472 0.30515537]
I0306 13:48:14.686771 140508698953536 detect.py:62] car, 0.49938303232192993, [0.04897165 0.06757799 0.12495686 0.19713354]
I0306 13:48:14.691031 140508698953536 detect.py:62] car, 0.49914953112602234, [0.17951395 0.02865338 0.24622466 0.1438287 ]
"
Obviously, the bboxes are all ok, but the scores are all below 0.5, so I debug the code:
"scores = confidence * class_probs" in models.py
"confidence" is very much close to 1, but "class_probs" is below 0.5 all the way.
So I'm confused.Is there anything wrong with my test?I run this code in tensorflow==2.10 by PyCharm.Inference by pretrained coco weights is fine.
Any one can give some advise?
Thx a lot!
The text was updated successfully, but these errors were encountered: