csuhan / s2anet

Official code of the paper "Align Deep Features for Oriented Object Detection"
376 stars 90 forks source link

Maybe a bug in old s2anet version #87

Closed Lg955 closed 3 years ago

Lg955 commented 3 years ago

I want to use the 79.42mAP model, but it only works in the old version. So I download the old one which need the .json annotation instead of .pkl . (If use the new version without Cascade, should I download the

S2A-Net | DOTA | R-50-FPN | - | - | 1x | 74.04 | cfg model -- | -- | -- | -- | -- | -- | -- | -- , right?) But when I load the json( generated from `/DOTA_devkit/prepare_dota1_ms.py` ), I found a error: `Traceback (most recent call last): File "demo/demo_inference.py", line 92, in save_det_result(args.config_file, args.out_dir,checkpoint_file=args.model,img_dir=args.img_dir, colormap=dota_colormap) File "demo/demo_inference.py", line 15, in save_det_result dataset = build_dataset(data_test) File "/dataset/lg_datacode/code/S2ANet_old/mmdet/datasets/builder.py", line 42, in build_dataset dataset = build_from_cfg(cfg, DATASETS, default_args) File "/dataset/lg_datacode/code/S2ANet_old/mmdet/utils/registry.py", line 76, in build_from_cfg return obj_cls(**args) File "/dataset/lg_datacode/code/S2ANet_old/mmdet/datasets/custom.py", line 65, in __init__ self.img_infos = self.load_annotations(self.ann_file) File "/dataset/lg_datacode/code/S2ANet_old/mmdet/datasets/dota_obb.py", line 65, in load_annotations img_info['filename'] = data_dict['filename'] TypeError: string indices must be integers` ![image](https://user-images.githubusercontent.com/69025725/124357965-ac3b6480-dc50-11eb-8b3e-fbdd9128a6fa.png) Tracking the source, the main bug is from `/mmdet/datasets/dota_obb.py` : ![image](https://user-images.githubusercontent.com/69025725/124358160-92e6e800-dc51-11eb-83a6-247671c42f36.png) Besides, the first loop in data_dicts is "images", the second loop is "categories", but the categories doesn't have "filename"、"height"、"width" . So I think this is a bug, hoping soon reply. Thanks!
csuhan commented 3 years ago

This is not a bug.

Notice we will generate two types of annotation:

By default, we use generate_json_labels, see our config: https://github.com/csuhan/s2anet/blob/dce96b7aeee170a44a7a2518ec9d684377da287a/configs/dota/s2anet_r50_fpn_1x.py#L116-L120

In this type of config, the file name field is: https://github.com/csuhan/s2anet/blob/dce96b7aeee170a44a7a2518ec9d684377da287a/DOTA_devkit/DOTA2JSON.py#L74

Lg955 commented 3 years ago

Thanks! I make it!