/JPeft

Primary LanguagePythonMIT LicenseMIT

JPeft

Introduction

JPeft is an parameter-efficient fine-tuning toolkit based on Jittor and JDet.

Install

JDet environment requirements:

  • System: Linux(e.g. Ubuntu/CentOS/Arch), macOS, or Windows Subsystem of Linux (WSL)
  • Python version >= 3.7
  • CPU compiler (require at least one of the following)
    • g++ (>=5.4.0)
    • clang (>=8.0)
  • GPU compiler (optional)
    • nvcc (>=10.0 for g++ or >=10.2 for clang)
  • GPU library: cudnn-dev (recommend tar file installation, reference link)

Step 1: Install the requirements

git clone https://github.com/Jittor/JDet
cd JDet
python -m pip install -r requirements.txt

If you have any installation problems for Jittor, please refer to Jittor

Step 2: Install JDet

cd JDet
# suggest this 
python setup.py develop
# or
python setup.py install

If you don't have permission for install,please add --user.

Or use PYTHONPATH: You can add export PYTHONPATH=$PYTHONPATH:{you_own_path}/JDet/python into .bashrc, and run

source .bashrc

Getting Started

Datasets

The following datasets are supported in JDet, please check the corresponding document before use.

DOTA1.0/DOTA1.5/DOTA2.0 Dataset: dota.md.

FAIR Dataset: fair.md

SSDD/SSDD+: ssdd.md

You can also build your own dataset by convert your datas to DOTA format.

Config

JDet defines the used model, dataset and training/testing method by config-file, please check the config.md to learn how it works.

Train

python tools/run_net.py --config-file=configs/peft_resnet/s2anet_r50_fpn_1x_dota_full.py --task=train

Test

If you want to test the downloaded trained models, please set resume_path={you_checkpointspath} in the last line of the config file.

python tools/run_net.py --config-file=configs/peft_resnet/s2anet_r50_fpn_1x_dota_full.py --task=test

Test on images / Visualization

You can test and visualize results on your own image sets by:

python tools/run_net.py --config-file=configs/peft_resnet/s2anet_r50_fpn_1x_dota_full.py --task=vis_test

You can choose the visualization style you prefer, for more details about visualization, please refer to visualization.md.

Build a New Project

In this section, we will introduce how to build a new project(model) with JDet. We need to install JDet first, and build a new project by:

mkdir $PROJECT_PATH$
cd $PROJECT_PATH$
cp $JDet_PATH$/tools/run_net.py ./
mkdir configs

Then we can build and edit configs/base.py like $JDet_PATH$/configs/retinanet.py. If we need to use a new layer, we can define this layer at $PROJECT_PATH$/layers.py and import layers.py in $PROJECT_PATH$/run_net.py, then we can use this layer in config files. Then we can train/test this model by:

python run_net.py --config-file=configs/base.py --task=train
python run_net.py --config-file=configs/base.py --task=test

Methods of PEFT

All experiments are conducted on S2ANet-R50-FPN.

Models Dataset Sub_Image_Size/Overlap Lr schd mAP Paper Config
Full DOTA1.0 1024/200 1x 59.1 - config
BitFit DOTA1.0 1024/200 1x 59.8 ACL'22 config
Fixed DOTA1.0 1024/200 1x 64.2 - config
ConvAdapter DOTA1.0 1024/200 1x 66.2 CVPRW'24 config
AdaptFormer DOTA1.0 1024/200 1x 68.9 NeurIPS'22 config
LoRA DOTA1.0 1024/200 1x 69.7 ICLR'21 config
Partial-1 DOTA1.0 1024/200 1x 70.6 NeurIPS'14 config
Mona DOTA1.0 1024/200 1x 70.8 CVPR'25 config
Adapter DOTA1.0 1024/200 1x 73.8 ICML'19 config
LoRand DOTA1.0 1024/200 1x 60.2 CVPR'23 config

Notice:

  1. 1x : 12 epochs
  2. mAP: mean Average Precision on DOTA1.0 test set

Contact Us

Website: http://cg.cs.tsinghua.edu.cn/jittor/

Email: jittor@qq.com

File an issue: https://github.com/Jittor/jittor/issues

QQ Group: 761222083

The Team

JDet is currently maintained by the Tsinghua CSCG Group. If you are also interested in JDet and want to improve it, Please join us!

Citation

@article{hu2020jittor,
  title={Jittor: a novel deep learning framework with meta-operators and unified graph execution},
  author={Hu, Shi-Min and Liang, Dun and Yang, Guo-Ye and Yang, Guo-Wei and Zhou, Wen-Yang},
  journal={Science China Information Sciences},
  volume={63},
  number={222103},
  pages={1--21},
  year={2020}
}

Reference

  1. Jittor
  2. mmrotate
  3. Detectron2
  4. mmdetection
  5. maskrcnn_benchmark
  6. RotationDetection
  7. s2anet
  8. gliding_vertex
  9. oriented_rcnn
  10. r3det
  11. AerialDetection
  12. DOTA_devkit
  13. OBBDetection
  14. nk-remote