Closed darkhan-s closed 2 years ago
This seems to happen if I set --num-gpus
anything more than 1.
D-adapt was not trained with multiple GPUs before, so we didn't find this problem.
It seems that moving the following code from if __name__ == "__main__":
into the main
function will solve the problem.
args.source = utils.build_dataset(args.source[::2], args.source[1::2])
args.target = utils.build_dataset(args.target[::2], args.target[1::2])
args.test = utils.build_dataset(args.test[::2], args.test[1::2])
Hi @JunguangJiang, sorry that I continue on the closed issue, but this is a follow up to the same dataset. I have trained the model as per your recommendation first with the source dataset (50k images) only using
examples/domain_adaptation/object_detection/source_only.py
.
I run the command as follows:
python source_only.py \ --config-file config/faster_rcnn_vgg_16_cityscapes.yaml \ -s TLess datasets/TLESS_rendered_dataset \ -t TLessReal datasets/TLESS_real_dataset \ --test TLessTest datasets/TLESS_rendered_dataset TLessRealTest datasets/TLESS_real_dataset \ --finetune \ OUTPUT_DIR logs/source_only/faster_rcnn_vgg_16_cityscapes/tlessRendered2Real \ MODEL.ROI_HEADS.NUM_CLASSES 30
This gave me a result of AP 59.39
on the source dataset and AP 6.77
on the target.
So I decide to test it on the same source training data to see how it was performing using visualize.py
:
python visualize.py --config-file config/faster_rcnn_vgg_16_cityscapes.yaml \ --threshold 0.1 \ --test TLess datasets/TLESS_rendered_dataset --save-path visualizations/source_only/tlessRendered2Real \ MODEL.WEIGHTS logs/source_only/faster_rcnn_vgg_16_cityscapes/tlessRendered2Real/model_final.pth
And I get very poor detections even on the same data I was training it on (no detections at all if I set the threshold as 0.5, on average the confidence of the bounding boxes is around 20%). What could be the possible reason for such a big difference in the training metrics and the visualize.py metrics? Could it be so that I have to modify some image dimensions before feeding them to visualize.py?
Edit: both source and target image shapes are (540, 720, 3)
One possible reason is that you fail to load the model when visualizing the results.
A suggestion is that you can use tensorboard
to watch the detection results.
For instance,
tensorboard --logdir=logs
I guess there might be some issues with the processing of your dataset. You can print some intermediate results, such as instances
in line 45
of the visualize.py
file, to confirm what the original output of the model is.
Sorry for late response, have been testing other methods.
One possible reason is that you fail to load the model when visualizing the results. A suggestion is that you can use
tensorboard
to watch the detection results. For instance,tensorboard --logdir=logs
The problem is I don't have a screen to monitor such results, I am training it on a server.
I guess there might be some issues with the processing of your dataset. You can print some intermediate results, such as
instances
in line45
of thevisualize.py
file, to confirm what the original output of the model is.
This one works as expected:
Instances(num_instances=100, image_height=540, image_width=720, fields=[pred_boxes: Boxes(tensor([[5.0100e+02, 1.8443e+02, 5.3791e+02, 2.2163e+02], ...)), scores: tensor([0.2554, ...)), pred_classes: tensor([6, ....])])
Hello,
I am testing your
examples/domain_adaptation/object_detection/d_adapt/d_adapt.py
method on my custom dataset (30 classes), which i converted to VOC format. Initially, I trained it onsource-only.py
successfully, but when trying to rund-adapt.py
, I receive the following error.I have registered the base class in
tllib/vision/datasets/object_detection/__init__.py
same way as in the provided CityScapesBase class:And then the target and the test classes inherit from it.
Could you please suggest what I am missing?