What's wrong with the box loss of training?
The results of training with your own dataset are as follows. What's the matter?

That loss looks pretty normal to me, what's the issue?
@CraigWang1 The box loss is zero and doesn't change at all. It's the same for me when training on coco. I haven't done the evaluation yet, we'll see if it is a problem.
The results of the above training tests are as follows:
It didn't turn out to be good for me either:

After some investigation it seems to me that the target boxes are not loaded properly, they are all zeros, so I'll try to do the train data generation from scratch. But it is also strange that the mask is all zero everywhere.
My problem is finally solved, I used the coco to tfrecords command from the readme without thinking:
$ mkdir tfrecrod
$ PYTHONPATH=".:$PYTHONPATH" python dataset/create_coco_tfrecord.py \
--image_dir=val2017 \
--caption_annotations_file=annotations/captions_val2017.json \
--output_file_prefix=tfrecord/val \
--num_shards=32
Obviously, for object detection not the caption annotation, but the instance annotation file should be used. So instead of this line:
--caption_annotations_file=annotations/captions_train2017.json
it should be:
--object_annotations_file=annotations/instances_train2017.json
@honghande I advise you to check whether the target boxes are properly loaded. I added these lines to the _box_loss function to the det_model_fun.py and followed the change in tensorboard:
utils.scalar('box_loss_debug/mask_sum',tf.math.reduce_sum(tf.math.abs(tf.cast(mask, dtype=tf.int8))))
utils.scalar('box_loss_debug/box_outputs_sum',tf.math.reduce_sum(tf.math.abs(box_outputs)))
utils.scalar('box_loss_debug/box_targets_sum',tf.math.reduce_sum(tf.math.abs(box_targets)))
And then I also checked the tfrecord files.
The command to convert CCO data to tfrecord data format is as follows:
PYTHONPATH=".:$PYTHONPATH" python dataset/create_coco_tfrecord.py
--image_dir=/data/internet/AI/dataset/label2coco_val/val
--object_annotations_file=/data/internet/AI/dataset/label2coco_val/val.json
--output_file_prefix=tfrecrod_gsval/val
--num_shards=32
give the result as follows:
I0401 10:07:09.788161 140295929337664 create_coco_tfrecord.py:218] Building bounding box index. I0401 10:07:09.791546 140295929337664 create_coco_tfrecord.py:229] 0 images are missing bboxes. I0401 10:07:09.817166 140295929337664 create_coco_tfrecord.py:326] On image 0 of 1000 I0401 10:07:09.864326 140295929337664 create_coco_tfrecord.py:326] On image 100 of 1000 I0401 10:07:09.934556 140295929337664 create_coco_tfrecord.py:326] On image 200 of 1000 I0401 10:07:10.013778 140295929337664 create_coco_tfrecord.py:326] On image 300 of 1000 I0401 10:07:10.051057 140295929337664 create_coco_tfrecord.py:326] On image 400 of 1000 I0401 10:07:10.088418 140295929337664 create_coco_tfrecord.py:326] On image 500 of 1000 I0401 10:07:10.122422 140295929337664 create_coco_tfrecord.py:326] On image 600 of 1000 I0401 10:07:10.142740 140295929337664 create_coco_tfrecord.py:326] On image 700 of 1000 I0401 10:07:10.181127 140295929337664 create_coco_tfrecord.py:326] On image 800 of 1000 I0401 10:07:10.196460 140295929337664 create_coco_tfrecord.py:326] On image 900 of 1000 I0401 10:07:10.319193 140295929337664 create_coco_tfrecord.py:338] Finished writing, skipped 0 annotations.
On my dataset, bbox loss on validation set is 0 from the very begining I guess the bug still exists here.
Probably you made a mistake in converting COCO dataset to tf_records. Refer to
@Alex220284, I believe you've managed to solve your training problem and closed the issue - that's great. Would you be kind enough to share your solution?
I have made a mistake on creating the training tfrecord by setting the param "caption_annotations_file" to "captions_train2017.json". In fact, Since I rectify the command to set param "object_annotations_file" to "instances_train2017.json", all things go as expected. Hope this is helpful to you.
Originally posted by @Alex220284 in https://github.com/google/automl/issues/91#issuecomment-605915288
This issue is similar to https://github.com/google/automl/issues/68 and https://github.com/google/automl/issues/94, and the problem of 0 mAP should have been resolved.
I am going to close this issue for now.