akhilpm / DroneDetectron2

Pytorch code for our CVPRw 2023 paper "Cascaded Zoom-in Detector for High Resolution Aerial Images"
MIT License
52 stars 7 forks source link

train with Retinanet #24

Closed mahilaMoghadami closed 1 year ago

mahilaMoghadami commented 1 year ago

hello is RetinaNet-ResNet.yaml complete config file for cascadezoom-in training on Retinanet?

akhilpm commented 1 year ago

I haven't tested RetinaNet properly, it was from some preliminary experiments. Then I moved to FCOS to try an anchor-free detector.

mahilaMoghadami commented 1 year ago

I tried to train FCOS but I get this error:

INFO:croptrain.data.datasets.visdrone:Loaded 548 images in COCO format from /home/mahilamoghadami.mut/CZDet/dataset/VisDrone/annotations_VisDrone_val.json INFO:croptrain.engine.inference_fcos:Start inference on 548 batches INFO:croptrain.engine.inference_fcos:Inference done 11/548. Dataloading: 0.0010 s/iter. Inference: 0.1016 s/iter. Eval: 0.0006 s/iter. Total: 0.1032 s/iter. ETA=0:00:55 INFO:croptrain.engine.inference_fcos:Inference done 59/548. Dataloading: 0.0017 s/iter. Inference: 0.1027 s/iter. Eval: 0.0006 s/iter. Total: 0.1051 s/iter. ETA=0:00:51 INFO:croptrain.engine.inference_fcos:Inference done 107/548. Dataloading: 0.0020 s/iter. Inference: 0.1026 s/iter. Eval: 0.0006 s/iter. Total: 0.1053 s/iter. ETA=0:00:46 INFO:croptrain.engine.inference_fcos:Inference done 155/548. Dataloading: 0.0020 s/iter. Inference: 0.1026 s/iter. Eval: 0.0006 s/iter. Total: 0.1052 s/iter. ETA=0:00:41 INFO:croptrain.engine.inference_fcos:Inference done 202/548. Dataloading: 0.0020 s/iter. Inference: 0.1027 s/iter. Eval: 0.0010 s/iter. Total: 0.1057 s/iter. ETA=0:00:36 INFO:croptrain.engine.inference_fcos:Inference done 249/548. Dataloading: 0.0020 s/iter. Inference: 0.1031 s/iter. Eval: 0.0009 s/iter. Total: 0.1061 s/iter. ETA=0:00:31 INFO:croptrain.engine.inference_fcos:Inference done 296/548. Dataloading: 0.0020 s/iter. Inference: 0.1032 s/iter. Eval: 0.0009 s/iter. Total: 0.1062 s/iter. ETA=0:00:26 INFO:croptrain.engine.inference_fcos:Inference done 344/548. Dataloading: 0.0020 s/iter. Inference: 0.1033 s/iter. Eval: 0.0008 s/iter. Total: 0.1061 s/iter. ETA=0:00:21 INFO:croptrain.engine.inference_fcos:Inference done 392/548. Dataloading: 0.0020 s/iter. Inference: 0.1033 s/iter. Eval: 0.0008 s/iter. Total: 0.1061 s/iter. ETA=0:00:16 INFO:croptrain.engine.inference_fcos:Inference done 439/548. Dataloading: 0.0020 s/iter. Inference: 0.1034 s/iter. Eval: 0.0011 s/iter. Total: 0.1066 s/iter. ETA=0:00:11 INFO:croptrain.engine.inference_fcos:Inference done 486/548. Dataloading: 0.0021 s/iter. Inference: 0.1035 s/iter. Eval: 0.0010 s/iter. Total: 0.1066 s/iter. ETA=0:00:06 INFO:croptrain.engine.inference_fcos:Inference done 533/548. Dataloading: 0.0021 s/iter. Inference: 0.1035 s/iter. Eval: 0.0010 s/iter. Total: 0.1067 s/iter. ETA=0:00:01 INFO:croptrain.engine.inference_fcos:Total inference time: 0:00:57.919741 (0.106666 s / iter per device, on 1 devices) INFO:croptrain.engine.inference_fcos:Total inference pure compute time: 0:00:56 (0.103500 s / iter per device, on 1 devices) Traceback (most recent call last): File "train_fcos.py", line 89, in launch( File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/engine/launch.py", line 82, in launch main_func(*args) File "train_fcos.py", line 80, in main return trainer.train() File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/engine/defaults.py", line 484, in train super().train(self.start_iter, self.max_iter) File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 150, in train self.after_step() File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/engine/train_loop.py", line 180, in after_step h.after_step() File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/engine/hooks.py", line 552, in after_step self._do_eval() File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/engine/hooks.py", line 525, in _do_eval results = self._func() File "/home/mahilamoghadami.mut/CZDet/DroneDetectron2/croptrain/engine/trainer_fcos.py", line 234, in test_and_save_results self._last_eval_results = self.test_crop(self.cfg, self.model, self.iter) File "/home/mahilamoghadami.mut/CZDet/DroneDetectron2/croptrain/engine/trainer_fcos.py", line 278, in test_crop results_i = inference_fcos.inference_with_crops(model, data_loader, evaluator, cfg, iter) File "/home/mahilamoghadami.mut/CZDet/DroneDetectron2/croptrain/engine/inference_fcos.py", line 124, in inference_with_crops results = evaluator.evaluate() File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/evaluation/coco_evaluation.py", line 194, in evaluate self._eval_predictions(predictions, img_ids=img_ids) File "/home/mahilamoghadami.mut/miniconda3/envs/CZDET/lib/python3.8/site-packages/detectron2/evaluation/coco_evaluation.py", line 228, in _eval_predictions assert category_id < num_classes, ( AssertionError: A prediction has class=10, but the dataset only has 10 classes and predicted class id should be in [0, 9].

while I trained FaterRCNN with your code without any error. I mean that data structure and classes are ok without any changes.