Skip to content

easyt0re/mmrotate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 简体中文

Introduction

The original project is mmrotate. I forked a copy for my personal study. Let's hope I did it the correct way.

I might need to put this to private but I don't know how for the moment.

  • The 1st step, or maybe the 0th step, is to use the "vanilla" version properly, get with the program.
  • through this process, I might want to keep track of commands I use to "set up shops" and automate.
    • seems a bit hard to do. bad docs. search error msg can solve most things.
  • The current step is to study a mod version of the project, supposedly.
  • to understand the changes, I might want to update folder by folder. This could also be a backup when I cannot fully understand or capture all the changes.
    • didn't do this part. I probably don't need to.

daily todo here

  • anaylyze tensorboard from yesterday
  • o-rep on 2 dataset train more + 200
  • r-frcnn implementation

start a todo list here

  • get the result on speed
  • think and search about overfitting
    • L1 or combination of L1/L2
    • dropout true
    • increase iou_thres in batch_non_max_suppression
    • adam
    • apparently, lr policy also helps
  • change class weights to "balance" weak/strong classes
    • by assign class gain in config file, roi_head, bbox_head, loss
    • do quick test to confirm we actually have the "correct" understanding of class weight
      • confirmed that it's indeed the correct order/weight
      • tried [0,100,0] and [0,0,100] on CA
  • reset lr policy to be constant/fixed (by default, it's step)
  • step: change when overfitting (val loss up instead of down)
    • read a bit more, step is not for solving overfitting it seems
    • warm up: "ResNet models, which use a low learning rate that increases linearly to the base learning rate in the first five epochs, and then decreases by a factor of 10 every 30 epochs.". our back bone is resnet.
    • current steping is not working properly, maybe need to give up
    • already applied to some of the model/set
    • can also use step outside of max epoch to "disable" step
  • mentioned focal loss, alpha, beta
    • model 2 and 4 use this, tuned alpha and gamma
  • even balance tasks: class/regress
  • try confusion matrix for visualization
    • worote a .sh to automate gen this for all 8 cases
  • run train back to back with sript
  • fix cannot resume or load
    • found this issue and try it out
    • probably not the version in use, not really useful
    • confirm hard to get resume working. load works.
  • seems that we have everything from the guy, redo that?
    • PRIORITY: get the code working with our structure of files

start a held list here

  • fine tune idea: looks like by default, stage 1 is frozen at all times. maybe cannot unfreeze. might run into CUDA mem error.
  • balanced set: the built-in one seems unsupported with numpy. maybe write my own as custom.
    • current env:
      Package Name Version
      mmcv-full 1.7.1
      mmdet 2.28.2
      mmengine 0.8.4
      mmrotate 0.3.4
      numpy 1.24.3
    • somehow, balanced set is using numpy.int, which is removed in 1.20.0
    • if we go numpy'<1.20.0', we will have 1.19.5, which doesn't support matplotlib
    • to get around it and mod the file locally, we narrow down to write our own custom dataset and wrapper
    • it's confirmed that we don't have that error anymore but whether it helps with an unbalanced set still needs to be tested
    • these mods should not affect other part of the code
  • finally stumbled upon this: PolyRandomRotate. seems like it only rotate certain classes, might help with unbalanced. however, I still feel like we should sample this class more, or have more in this class, rather than rotate
    • applied this to SOME current "test" versions of config, maybe helped with overfitting
    • maybe do this to all cases
    • explore rect_class, currently use None

new things to do, seems like most of the things here we've already implemented

then I found this repo that points to this post

here are some of the notes and thoughts from this reading

  • 数据集存在长尾效应
  • 考虑到比赛规则中对检测速度没有要求,且这种失衡比单纯采用过/欠采样和调节各类别的loss权重效果都不会太好,所以选择为部分类别单独训练一个检测器是性价比极高的做法。同时为了平衡各个类别的分布,一些多样本数据增强策略是可以尝试的。
  • maybe we really need to chop things up, see 离线数据处理
  • learn train pipeline
  • 最大的好处就是绝对不会过拟合
  • 在训练后期关闭多样本数据增强继续训练,此时的精度提升就十分明显
  • Anchor-free算法只有Oriented Reppoints性能表现最好
  • Anchor-Based算法中旋转RoI系列表现最佳
  • 最后的Neck选择 —— PANet
  • look at the conclusion part and more
  • Stochastic Weight Averaging (SWA), choose to ignore for now
  • backbone: swint, neck: PANet or ReFPN
  • chop things up with this
    • subsize=1024, stride=768 (gap=512)
    • MS = [0.5 0.75 1.0 1.5 2.0]

tensorboard reading notes here:

  • SRS o_rcnn
    • "best"
      • has a "nice" gain we like to follow
      • suspect things happened in the beginning and later of the train -> step policy
    • constant lr "sweep"
      • 5e-2, too big?
      • 5e-3, what we used, OK, something happened before 1/4 or 1/5
      • 5e-4, maybe small, maybe need longer, something happened around 1/4
  • CAS o_rcnn
    • max_epoch = 60, something happened right in the middle
    • 150 new best
      • consider step before 1/4, best at 11k/43k, 0.777
    • 50CA1e2
      • also something happened around 12k, coincidence? 0.75. 1e-2 might to large
  • o_rep
    • max_epoch = 80, hasn't reach overfitting yet -> run longer, load from
    • CA, could train longer, almost stable, maybe small lr, something good at 5k/22k
      • to 150, increased a little, consider step
    • SR, definitely train longer, 80 at 0.4, meaning 160 to see if 0.6, start with larger lr?
      • increased indeed, consider maybe even longer, 200. 150 is now
  • rfrcnn
    • SR, 100, best at 60, seems flat, consider step

note for given

  • seems range(0,1) is the same as 0 (1 gpu train)
  • all have specified work_dir, good, run for SR
  • need to change data_root or move data
  • need to change sample_per_gpu and worker_per_gpu
    • see this page here, we will need to try
    • CA reached 8, 8. (rfrcnn) but may not help
  • use --auto-resume flag in cmd to get true and seems to be working
    • resume not working but auto fine...

putting the env together is a bit old now, let's note this down

  • follow the instructions
  • sudo apt install libgl1-mesa-glx
  • pip install yapf==0.40.1
  • mmrotate, datasets, __init__ builder and the rest

somewhere here there is also

  • sudo apt-get install ffmpeg libsm6 libxext6

for the GUI software

  • conda install pyqt torchvision==0.9.0
    • seems that shouldn't do pyqt directly
    • it will upgrade torchvision to a newer version and break the whole thing
    • you still need to install a bunch of things with apt-get after this it seems
  • could not connect to any X display
    • of course, if we have a linux machine, it's not a problem
    • follow these steps specifically to make it work

MMRotate is an open-source toolbox for rotated object detection based on PyTorch. It is a part of the OpenMMLab project.

The master branch works with PyTorch 1.6+.

video.MP4
Major Features
  • Support multiple angle representations

    MMRotate provides three mainstream angle representations to meet different paper settings.

  • Modular Design

    We decompose the rotated object detection framework into different components, which makes it much easy and flexible to build a new model by combining different modules.

  • Strong baseline and State of the art

    The toolbox provides strong baselines and state-of-the-art methods in rotated object detection.

What's New

Highlight

We are excited to announce our latest work on real-time object recognition tasks, RTMDet, a family of fully convolutional single-stage detectors. RTMDet not only achieves the best parameter-accuracy trade-off on object detection from tiny to extra-large model sizes but also obtains new state-of-the-art performance on instance segmentation and rotated object detection tasks. Details can be found in the technical report. Pre-trained models are here.

PWC PWC PWC

Task Dataset AP FPS(TRT FP16 BS1 3090)
Object Detection COCO 52.8 322
Instance Segmentation COCO 44.6 188
Rotated Object Detection DOTA 78.9(single-scale)/81.3(multi-scale) 121

0.3.4 was released in 01/02/2023:

  • Fix compatibility with numpy, scikit-learn, and e2cnn.
  • Support empty patch in Rotate Transform
  • use iof for RRandomCrop validation

Please refer to changelog.md for details and release history.

Installation

MMRotate depends on PyTorch, MMCV and MMDetection. Below are quick steps for installation. Please refer to Install Guide for more detailed instruction.

dd: this seems to be outdated. the installation steps in the Install Guide have a more updated version.

dd: although the one in the docs also has some problem. once reached verify, step 1 will already give you some error. the inference demo is even worse.

dd: lesson of the day 20230923: why did I try to do this on windows? at least start from WSL

dd: change to WSL still has trouble downloading o_rcnn.py. but there is already a version of it in configs folder, using that one for the moment. somehow dd managed to run the download line. do comparison later.

conda create -n open-mmlab python=3.7 pytorch==1.7.0 cudatoolkit=10.1 torchvision -c pytorch -y
conda activate open-mmlab
pip install openmim
mim install mmcv-full
mim install mmdet
# dd: will stuck here with "OSError: CUDA_HOME environment variable is not set. 
#     Please set it to your CUDA install root."
git clone https://github.com/open-mmlab/mmrotate.git
cd mmrotate
pip install -r requirements/build.txt
pip install -v -e .

Get Started

Please see get_started.md for the basic usage of MMRotate. We provide colab tutorial, and other tutorials for:

Model Zoo

Results and models are available in the README.md of each method's config directory. A summary can be found in the Model Zoo page.

Supported algorithms:

Data Preparation

Please refer to data_preparation.md to prepare the data.

FAQ

Please refer to FAQ for frequently asked questions.

Contributing

We appreciate all contributions to improve MMRotate. Please refer to CONTRIBUTING.md for the contributing guideline.

Acknowledgement

MMRotate is an open source project that is contributed by researchers and engineers from various colleges and companies. We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks. We wish that the toolbox and benchmark could serve the growing research community by providing a flexible toolkit to reimplement existing methods and develop their own new methods.

Citation

If you use this toolbox or benchmark in your research, please cite this project.

@inproceedings{zhou2022mmrotate,
  title   = {MMRotate: A Rotated Object Detection Benchmark using PyTorch},
  author  = {Zhou, Yue and Yang, Xue and Zhang, Gefan and Wang, Jiabao and Liu, Yanyi and
             Hou, Liping and Jiang, Xue and Liu, Xingzhao and Yan, Junchi and Lyu, Chengqi and
             Zhang, Wenwei and Chen, Kai},
  booktitle={Proceedings of the 30th ACM International Conference on Multimedia},
  year={2022}
}

License

This project is released under the Apache 2.0 license.

Projects in OpenMMLab

  • MMCV: OpenMMLab foundational library for computer vision.
  • MIM: MIM installs OpenMMLab packages.
  • MMClassification: OpenMMLab image classification toolbox and benchmark.
  • MMDetection: OpenMMLab detection toolbox and benchmark.
  • MMDetection3D: OpenMMLab's next-generation platform for general 3D object detection.
  • MMRotate: OpenMMLab rotated object detection toolbox and benchmark.
  • MMSegmentation: OpenMMLab semantic segmentation toolbox and benchmark.
  • MMOCR: OpenMMLab text detection, recognition, and understanding toolbox.
  • MMPose: OpenMMLab pose estimation toolbox and benchmark.
  • MMHuman3D: OpenMMLab 3D human parametric model toolbox and benchmark.
  • MMSelfSup: OpenMMLab self-supervised learning toolbox and benchmark.
  • MMRazor: OpenMMLab model compression toolbox and benchmark.
  • MMFewShot: OpenMMLab fewshot learning toolbox and benchmark.
  • MMAction2: OpenMMLab's next-generation action understanding toolbox and benchmark.
  • MMTracking: OpenMMLab video perception toolbox and benchmark.
  • MMFlow: OpenMMLab optical flow toolbox and benchmark.
  • MMEditing: OpenMMLab image and video editing toolbox.
  • MMGeneration: OpenMMLab image and video generative models toolbox.
  • MMDeploy: OpenMMLab model deployment framework.

About

OpenMMLab Rotated Object Detection Toolbox and Benchmark

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.2%
  • Other 0.8%