Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image_demo bug. #613

Merged
merged 2 commits into from
Nov 15, 2022
Merged

Conversation

zytx121
Copy link
Collaborator

@zytx121 zytx121 commented Nov 13, 2022

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

To handle tensor bboxes in RotLocalVisualizer.
reslove #611

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the back-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. The documentation has been modified accordingly, like docstring or example tutorials.

@codecov
Copy link

codecov bot commented Nov 13, 2022

Codecov Report

❗ No coverage uploaded for pull request base (dev-1.x@766185e). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             dev-1.x     #613   +/-   ##
==========================================
  Coverage           ?   80.15%           
==========================================
  Files              ?       95           
  Lines              ?     6415           
  Branches           ?      906           
==========================================
  Hits               ?     5142           
  Misses             ?      976           
  Partials           ?      297           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@austinmw
Copy link

austinmw commented Nov 13, 2022

@zytx121 Hi, I tried to test this PR, but I seem to run into another bug with https://github.com/open-mmlab/mmrotate/blame/dev-1.x/mmrotate/datasets/transforms/transforms.py#L424

Traceback (most recent call last):
File "/opt/mmrotate/demo/image_demo.py", line 63, in
main(args)
File "/opt/mmrotate/demo/image_demo.py", line 45, in main
result = inference_detector(model, args.img)
File "/opt/mmdetection/mmdet/apis/inference.py", line 140, in inference_detector
data_ = test_pipeline(data_)
File "/opt/conda/lib/python3.8/site-packages/mmcv/transforms/base.py", line 12, in call
return self.transform(results)
File "/opt/conda/lib/python3.8/site-packages/mmcv/transforms/wrappers.py", line 87, in transform
results = t(results) # type: ignore
File "/opt/conda/lib/python3.8/site-packages/mmcv/transforms/base.py", line 12, in call
return self.transform(results)
File "/opt/mmrotate/mmrotate/datasets/transforms/transforms.py", line 427, in transform
for instance in results['instances']:
KeyError: 'instances'

Where the keys in results are instead:
dict_keys(['img_path', 'img_id', 'img', 'img_shape', 'ori_shape', 'scale', 'scale_factor', 'keep_ratio', 'homography_matrix', 'gt_bboxes', 'gt_ignore_flags', 'gt_bboxes_labels', 'gt_masks'])

@zytx121
Copy link
Collaborator Author

zytx121 commented Nov 14, 2022

Hi @austinmw If you want to use ConvertMask2BoxType, you need to add instances in the meta_keys just like

'scale_factor', 'instances'))

BTW, ConvertMask2BoxType can only be used with mmdet.CocoDataset at present. Could you show me your config (dataset part)? And let us know what your needs are and help us improve the code.

@austinmw
Copy link

austinmw commented Nov 15, 2022

Hi @zytx121,

I trained a v1.0.0rc0 Oriented R-CNN model on SRSDD dataset and exported with mmrotate2torchserve script. I then tried to use the contents of the torchserve export (configs, checkpoint) to run image_demo.py, but have run into these bugs.

Here's my launch training command:

mpirun --host algo-1-zwn0q -np 4 --allow-run-as-root --tag-output --oversubscribe -mca btl_tcp_if_include eth0 -mca oob_tcp_if_include eth0 -mca plm_rsh_no_tree_spawn 1 -mca pml ob1 -mca btl ^openib -mca orte_abort_on_non_zero_status 1 -mca btl_vader_single_copy_mechanism none -mca plm_rsh_num_concurrent 1 -x NCCL_SOCKET_IFNAME=eth0 -x NCCL_DEBUG=INFO -x LD_LIBRARY_PATH -x PATH -x SMDATAPARALLEL_USE_SINGLENODE=1 -x FI_PROVIDER=efa -x RDMAV_FORK_SAFE=1 -x LD_PRELOAD=/opt/conda/lib/python3.8/site-packages/gethostname.cpython-38-x86_64-linux-gnu.so -verbose -x NCCL_DEBUG=VERSION smddprun /opt/conda/bin/python3.8 -m mpi4py sagemaker_train.py --cfg-options seed=0 env_cfg.dist_cfg.backend='smddp' val_evaluator.collect_device='gpu' default_hooks.logger.interval=5 default_hooks.visualization.draw=True visualizer.save_dir='/opt/ml/checkpoints' train_dataloader.dataset.data_root='/opt/ml/input/data/srsdd/' val_dataloader.dataset.data_root='/opt/ml/input/data/srsdd/' train_cfg.val_interval=5 train_cfg.max_epochs=20 load_from='https://download.openmmlab.com/mmrotate/v0.1.0/oriented_rcnn/oriented_rcnn_r50_fpn_fp16_1x_dota_le90/oriented_rcnn_r50_fpn_fp16_1x_dota_le90-57c88621.pth' --config configs/oriented_rcnn/oriented-rcnn-le90_r50_fpn_6x_srsdd.py --torchserve True

I'm not sure where ConvertMask2BoxType comes from can't seem to find it

@RangiLyu RangiLyu merged commit e458ee8 into open-mmlab:dev-1.x Nov 15, 2022
triple-Mu pushed a commit to triple-Mu/mmrotate that referenced this pull request Jan 31, 2023
* update

* Update local_visualizer.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants