{"id":19216999,"url":"https://github.com/hustvl/sparseinst","last_synced_at":"2025-04-04T12:08:47.577Z","repository":{"id":37296026,"uuid":"465182360","full_name":"hustvl/SparseInst","owner":"hustvl","description":"[CVPR 2022] SparseInst: Sparse Instance Activation for Real-Time Instance Segmentation","archived":false,"fork":false,"pushed_at":"2023-10-20T16:52:13.000Z","size":12811,"stargazers_count":600,"open_issues_count":57,"forks_count":73,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-03-28T11:10:10.558Z","etag":null,"topics":["detectron2","instance-segmentation","object-detection","panoptic-segmentation","real-time"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hustvl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-02T06:20:42.000Z","updated_at":"2025-03-16T10:44:24.000Z","dependencies_parsed_at":"2024-11-09T14:19:52.889Z","dependency_job_id":"4bc92950-d05f-42f8-a791-bf75f245c852","html_url":"https://github.com/hustvl/SparseInst","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustvl%2FSparseInst","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustvl%2FSparseInst/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustvl%2FSparseInst/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustvl%2FSparseInst/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hustvl","download_url":"https://codeload.github.com/hustvl/SparseInst/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174423,"owners_count":20896078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detectron2","instance-segmentation","object-detection","panoptic-segmentation","real-time"],"created_at":"2024-11-09T14:19:48.302Z","updated_at":"2025-04-04T12:08:47.556Z","avatar_url":"https://github.com/hustvl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"assets/banner.gif\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\nTianheng Cheng, \u003ca href=\"https://xwcv.github.io/\"\u003eXinggang Wang\u003c/a\u003e\u003csup\u003e\u003cspan\u003e\u0026#8224;\u003c/span\u003e\u003c/sup\u003e, Shaoyu Chen, Wenqiang Zhang, \u003ca href=\"https://scholar.google.com/citations?user=pCY-bikAAAAJ\u0026hl=zh-CN\"\u003eQian Zhang\u003c/a\u003e, \u003ca href=\"https://scholar.google.com/citations?user=IyyEKyIAAAAJ\u0026hl=zh-CN\"\u003eChang Huang\u003c/a\u003e, \u003ca href=\"https://zhaoxiangzhang.net/\"\u003eZhaoxiang Zhang\u003c/a\u003e, \u003ca href=\"http://eic.hust.edu.cn/professor/liuwenyu/\"\u003e Wenyu Liu\u003c/a\u003e\n\u003c/br\u003e\n(\u003cspan\u003e\u0026#8224;\u003c/span\u003e: corresponding author)\n\n\u003c!-- \u003cdiv\u003e\u003ca href=\"\"\u003e[Project Page]\u003c/a\u003e(comming soon)\u003c/div\u003e  --\u003e\n\u003cdiv\u003e\n\u003ca href=\"https://arxiv.org/abs/2203.12827\"\u003e[arXiv paper]\u003c/a\u003e\n\u003ca href=\"https://openaccess.thecvf.com/content/CVPR2022/papers/Cheng_Sparse_Instance_Activation_for_Real-Time_Instance_Segmentation_CVPR_2022_paper.pdf\"\u003e[CVPR paper]\u003c/a\u003e\n\u003ca href=\"https://drive.google.com/file/d/1xhqQvQ0YVCHd8XQxnCVqef75Hey7kI-d/view?usp=sharing\"\u003e[slides]\u003c/a\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\n\n\n## Highlights \n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"assets/animate.gif\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cdiv\u003e\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/sparse-instance-activation-for-real-time/real-time-instance-segmentation-on-mscoco)](https://paperswithcode.com/sota/real-time-instance-segmentation-on-mscoco?p=sparse-instance-activation-for-real-time)\n\u003c/div\u003e\n\u003c/div\u003e\n\n\n\n* SparseInst presents a new object representation method, *i.e.*, Instance Activation Maps (IAM), to adaptively highlight informative regions of objects for recognition.\n* SparseInst is a simple, efficient, and fully convolutional framework without non-maximum suppression (NMS) or sorting, and easy to deploy!\n* SparseInst achieves good trade-off between speed and accuracy, *e.g.*, 37.9 AP and 40 FPS with 608x input.\n\n\n\n## Updates\n\n`This project is under active development, please stay tuned!` \u0026#9749;\n\n* `[2022-10-31]`: We release the models \u0026 weights for the [`CSP-DarkNet53`](configs/sparse_inst_cspdarknet53_giam.yaml) backbone. Which is a strong baseline with highly-competitve inference speed and accuracy.\n\n* `[2022-10-19]`: We provide the implementation and inference code based on [MindSpore](https://www.mindspore.cn/), a nice and efficient Deep Learning framework. Thanks [Ruiqi Wang](https://github.com/RuiqiWang00) for this kind contribution!\n\n* `[2022-8-9]`: We provide the FLOPs counter [`get_flops.py`](./tools/get_flops.py) to obtain the FLOPs/Parameters of SparseInst. This update also includes some bugfixs.\n\n* `[2022-7-17]`: `Faster`\u0026#128640;:  SparseInst now supports [training and inference with **FP16**](https://github.com/hustvl/SparseInst#-sparseinst-with-fp16). Inference with FP16 improves the speed by **30\\%**. `Robust`: we replace the `Sigmoid + Norm` with [`Softmax`](configs/sparse_inst_r50_giam_softmax.yaml) for numerical stability, especially for ONNX. `Easy-to-Use`: we provide the [script](./onnx/convert_onnx.py) for exporting SparseInst to ONNX models.\n\n* `[2022-4-29]`: We fix the **common issue** about the visualization `demo.py`, *e.g.,* `ValueError: GenericMask cannot handle ...`. \n\n* `[2022-4-7]`: We provide the `demo` code for visualization and inference on images. Besides, we have added more backbones for SparseInst, including [ResNet-101](https://arxiv.org/abs/1512.03385), [CSPDarkNet](https://arxiv.org/pdf/2004.10934v1.pdf), and [PvTv2](https://arxiv.org/abs/2102.12122). We are still supporting more backbones.\n\n* `[2022-3-25]`: We have released the code and models for SparseInst! \n\n \n\n## Overview\n**SparseInst** is a conceptually novel, efficient, and fully convolutional framework for real-time instance segmentation.\nIn contrast to region boxes or anchors (centers), SparseInst adopts a sparse set of **instance activation maps** as object representation, to highlight informative regions for each foreground objects.\nThen it obtains the instance-level features by aggregating features according to the highlighted regions for recognition and segmentation.\nThe bipartite matching compels the instance activation maps to predict objects in a one-to-one style, thus avoiding non-maximum suppression (NMS) in post-processing. Owing to the simple yet effective designs with instance activation maps, SparseInst has extremely fast inference speed and achieves **40 FPS** and **37.9 AP** on COCO (NVIDIA 2080Ti), significantly outperforms the counter parts in terms of speed and accuracy.\n\n\n\u003ccenter\u003e\n\u003cimg src=\"./assets/sparseinst.png\"\u003e\n\u003c/center\u003e\n\n\n## Models\n\nWe provide two versions of SparseInst, *i.e.*, the basic IAM (3x3 convolution) and the Group IAM (G-IAM for short), with different backbones.\nAll models are trained on MS-COCO *train2017*.\n\n#### Fast models\n\n| model | backbone | input | aug | AP\u003csup\u003eval\u003c/sup\u003e |  AP  | FPS | weights |\n| :---- | :------  | :---: | :-: |:--------------: | :--: | :-: | :-----: |\n| [SparseInst](configs/sparse_inst_r50_base.yaml) | [R-50](https://drive.google.com/file/d/1Ee6nPXlj1eewAnooYtoPtLzbRp_mDxfB/view?usp=sharing) | 640 | \u0026#x2718; | 32.8 | 33.2 | 44.3 | [model](https://drive.google.com/file/d/12RQLHD5EZKIOvlqW3avUCeYjFG1NPKDy/view?usp=sharing) |\n| [SparseInst](sparse_inst_r50vd_base.yaml) | [R-50-vd](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth) | 640 | \u0026#x2718; | 34.1 | 34.5 | 42.6 | [model](https://drive.google.com/file/d/1fjPFy35X2iJu3tYwVdAq4Bel82PfH5kx/view?usp=sharing)|\n| [SparseInst (G-IAM)](configs/sparse_inst_r50_giam.yaml) | [R-50](https://drive.google.com/file/d/1Ee6nPXlj1eewAnooYtoPtLzbRp_mDxfB/view?usp=sharing) | 608 | \u0026#x2718; | 33.4 | 34.0 | 44.6 | [model](https://drive.google.com/file/d/1pXU7Dsa1L7nUiLU9ULG2F6Pl5m5NEguL/view?usp=sharing) |\n| [SparseInst (G-IAM, Softmax)](configs/sparse_inst_r50_giam_soft.yaml) | [R-50](https://drive.google.com/file/d/1Ee6nPXlj1eewAnooYtoPtLzbRp_mDxfB/view?usp=sharing) | 608 | \u0026#x2718; | 33.6 | - | 44.6 | [model](https://drive.google.com/file/d/1doterrG89SjmLxDyU8IhLYRGxVH69sR2/view?usp=sharing) |\n| [SparseInst (G-IAM)](configs/sparse_inst_r50_giam_aug.yaml) | [R-50](https://drive.google.com/file/d/1Ee6nPXlj1eewAnooYtoPtLzbRp_mDxfB/view?usp=sharing) | 608 | \u0026#10003; | 34.2 | 34.7 | 44.6 | [model](https://drive.google.com/file/d/1MK8rO3qtA7vN9KVSBdp0VvZHCNq8-bvz/view?usp=sharing) |\n| [SparseInst (G-IAM)](configs/sparse_inst_r50_dcn_giam_aug.yaml) | [R-50-DCN](https://drive.google.com/file/d/1Ee6nPXlj1eewAnooYtoPtLzbRp_mDxfB/view?usp=sharing) | 608 | \u0026#10003;| 36.4 | 36.8 | 41.6 | [model](https://drive.google.com/file/d/1qxdLRRHbIWEwRYn-NPPeCCk6fhBjc946/view?usp=sharing) |\n| [SparseInst (G-IAM)](configs/sparse_inst_r50vd_giam_aug.yaml) | [R-50-vd](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth) | 608 | \u0026#10003;| 35.6 | 36.1 | 42.8| [model](https://drive.google.com/file/d/1dlamg7ych_BdWpPUCuiBXbwE0SXpsfGx/view?usp=sharing) |\n| [SparseInst (G-IAM)](configs/sparse_inst_r50vd_dcn_giam_aug.yaml) | [R-50-vd-DCN](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth) | 608 | \u0026#10003; | 37.4 | 37.9 | 40.0  | [model](https://drive.google.com/file/d/1clYPdCNrDNZLbmlAEJ7wjsrOLn1igOpT/view?usp=sharing)|\n| [SparseInst (G-IAM)](configs/sparse_inst_r50vd_dcn_giam_aug.yaml) | [R-50-vd-DCN](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/resnet50d_ra2-464e36ba.pth) | 640 | \u0026#10003; | 37.7 | 38.1 | 39.3 |  [model](https://drive.google.com/file/d/1clYPdCNrDNZLbmlAEJ7wjsrOLn1igOpT/view?usp=sharing)| \n\n#### SparseInst with other backbones\n\n| model | backbone | input | AP\u003csup\u003eval\u003c/sup\u003e |  AP  | FPS | weights |\n| :---- | :------ | :---: | :--------------: | :--: | :-: | :-----: |\n| SparseInst (G-IAM) | [CSPDarkNet](configs/sparse_inst_cspdarknet53_giam.yaml) | 640 | 35.1 | -| - | [model](https://drive.google.com/file/d/1rcUJWUbusM216Zbtmo_xB774jdjb3qSt/view?usp=sharing) |\n\n#### Larger models\n\n| model | backbone | input | aug  | AP\u003csup\u003eval\u003c/sup\u003e |  AP  | FPS | weights |\n| :---- | :------ | :---: | :---: | :--------------: | :--: | :-: | :-----: |\n| [SparseInst (G-IAM)](configs/sparse_inst_r101_giam.yaml) | [R-101](https://drive.google.com/file/d/1-6ZBvC55unwuHvGn-Xf4xuy2Qr1vC7Zo/view?usp=sharing) | 640 | \u0026#x2718; | 34.9 | 35.5 | - | [model](https://drive.google.com/file/d/1EZZck-UNfom652iyDhdaGYbxS0MrO__z/view?usp=sharing)|\n| [SparseInst (G-IAM)](configs/sparse_inst_r101_dcn_giam.yaml) | [R-101-DCN](https://drive.google.com/file/d/1-6ZBvC55unwuHvGn-Xf4xuy2Qr1vC7Zo/view?usp=sharing) | 640 | \u0026#x2718; | 36.4 | 36.9 | - | [model](https://drive.google.com/file/d/1shkFvyBmDlWRxl1ActD6VfZJTJYBGBjv/view?usp=sharing) |\n\n#### SparseInst with Vision Transformers\n\n| model | backbone | input | aug | AP\u003csup\u003eval\u003c/sup\u003e |  AP  | FPS | weights |\n| :---- | :------ | :---: | :---: | :--------------: | :--: | :-: | :-----: |\n| [SparseInst (G-IAM)](configs/sparse_inst_pvt_b1_giam.yaml) | [PVTv2-B1](https://drive.google.com/file/d/1B7JTO0WqyhFn7nvUlRf6qKQrFzTnRWDC/view?usp=sharing) | 640 |  \u0026#x2718; | 35.3 | 36.0 | 33.5 (48.9\u003csup\u003e\u0026#x021A1;\u003c/sup\u003e)| [model](https://drive.google.com/file/d/13l9JgTz3sF6j3vSVHOOhAYJnCf-QuNe_/view?usp=sharing) |\n| [SparseInst (G-IAM)](configs/sparse_inst_pvt_b2_li_giam.yaml) | [PVTv2-B2-li](https://drive.google.com/file/d/1YhjCH4FZa9ekWUqa-JovEfAR2wuUXEtQ/view?usp=sharing) | 640 |  \u0026#x2718; | 37.2 | 38.2 | 26.5 | [model](https://drive.google.com/file/d/1DFxQnFg_UL6kmMoNC4StUKo79RXVHyNF/view?usp=sharing) |\n\n\u003csup\u003e\u0026#x021A1;\u003c/sup\u003e: measured on RTX 3090.\n\n\n**Note:** \n* **We will continue adding more models** including more efficient convolutional networks, vision transformers, and larger models for high performance and high speed, please stay tuned \u0026#128513;!\n* Inference speeds are measured on one NVIDIA 2080Ti unless specified.\n* We haven't adopt TensorRT or other tools to accelerate the inference of SparseInst. However, we are working on it now and will provide support for ONNX, TensorRT, MindSpore, [Blade](https://github.com/alibaba/BladeDISC), and other frameworks as soon as possible!\n* AP denotes AP evaluated on MS-COCO *test-dev2017*\n* *input* denotes the shorter side of the input, *e.g.*, 512x864 and 608x864, we keep the aspect ratio of the input and the longer side is no more than 864.\n* The inference speed might slightly change on different machines (2080 Ti) and different versions of detectron (we mainly use [v0.3](https://github.com/facebookresearch/detectron2/tree/v0.3)). If the change is sharp, e.g., \u003e 5ms, please feel free to contact us.\n* For `aug` (augmentation), we only adopt the simple random crop (crop size: [384, 600]) provided by detectron2.\n* We adopt `weight decay=5e-2` as default setting, which is slightly different from the original paper.\n* **[Weights on BaiduPan]**: we also provide trained models on BaiduPan: [ShareLink](https://pan.baidu.com/s/1tot7Wcoi4J1xh8ZS7VikZg) (password: lkdo).\n\n## Installation and Prerequisites\n\nThis project is built upon the excellent framework [detectron2](https://github.com/facebookreseach/detectron2), and you should install detectron2 first, please check [official installation guide](https://detectron2.readthedocs.io/en/latest/tutorials/install.html) for more details.\n\n**Updates:** SparseInst works well on [detectron2-v0.6](https://github.com/facebookresearch/detectron2/tree/v0.6). \n\n**Note:** previously, we mainly use [v0.3](https://github.com/facebookresearch/detectron2/tree/v0.3) of detectron2 for experiments and evaluations. Besides, we also test our code on the newest version [v0.6](https://github.com/facebookresearch/detectron2/tree/v0.6). If you find some bugs or incompatibility problems of higher version of detectron2, please feel free to raise a issue!\n\nInstall the detectron2:\n\n```bash\ngit clone https://github.com/facebookresearch/detectron2.git\n# if you swith to a specific version, e.g., v0.3 (recommended) or v0.6\ngit checkout tags/v0.6\n# build detectron2\npython setup.py build develop\n```\n\n## Getting Start\n\n\n### \u0026#128293; SparseInst with FP16\n\nSparseInst with FP16 achieves 30% faster inference speed and saves much training memory, we provide some comparisons about the memory, inference speed, and training speed in the below table.\n\n|  FP16 | train mem.(log) | train mem.(`nvidia-smi`) | train speed | infer. speed | \n| :---: | :-------------: | :----------------------: | :---------: | :----------: |\n| \u0026#x2718; | 6.0G | 10.5G | 0.8690s/iter | 52.17 FPS |\n| \u0026#10003; | 3.9G | 6.8G  | 0.6949s/iter | 67.57 FPS |\n\nNote: statistics are measured on NVIDIA 3090. With FP16, we have faster training speed and can also increase the batch size for better performance.\n\n* Training with FP16: enable FP16 is simple, you only need to enable `SOLVER.AMP.ENABLED=True`, or add this configuration to the config file.\n\n```bash\npython tools/train_net.py --config-file configs/sparse_inst_r50_giam_fp16.yaml --num-gpus 8 SOLVER.AMP.ENABLED True\n```\n\n* Testing with FP16: enable FP16 for inference by adding `--fp16`.\n\n```bash\npython tools/test_net.py --config-file configs/sparse_inst_r50_giam_fp16.yaml --fp16 MODEL.WEIGHTS model_final.pth \n```\n\n### Testing SparseInst\n\nBefore testing, you should specify the config file `\u003cCONFIG\u003e` and the model weights `\u003cMODEL-PATH\u003e`. In addition, you can change the input size by setting the `INPUT.MIN_SIZE_TEST` in both config file or commandline.\n\n* [Performance Evaluation] To obtain the evaluation results, *e.g.*, mask AP on COCO, you can run:\n\n```bash\npython tools/train_net.py --config-file \u003cCONFIG\u003e --num-gpus \u003cGPUS\u003e --eval MODEL.WEIGHTS \u003cMODEL-PATH\u003e\n# example:\npython tools/train_net.py --config-file configs/sparse_inst_r50_giam.yaml --num-gpus 8 --eval MODEL.WEIGHTS sparse_inst_r50_giam_aug_2b7d68.pth\n```\n\n* [Inference Speed] To obtain the inference speed (FPS) on one GPU device, you can run:\n\n```bash\npython tools/test_net.py --config-file \u003cCONFIG\u003e MODEL.WEIGHTS \u003cMODEL-PATH\u003e INPUT.MIN_SIZE_TEST 512\n# example:\npython tools/test_net.py --config-file configs/sparse_inst_r50_giam.yaml MODEL.WEIGHTS sparse_inst_r50_giam_aug_2b7d68.pth INPUT.MIN_SIZE_TEST 512\n```\n\n**Note:** \n* The [`tools/test_net.py`](./tools/test_net.py) only supports **1 GPU** and **1 image per batch** for measuring inference speed.\n* The inference time consists of the *pure forward time* and the *post-processing time*. While the evaluation processing, data loading, and pre-processing for wrappers (*e.g.*, ImageList) are not included.\n* `COCOMaskEvaluator` is modified from [`COCOEvaluator`](https://github.com/facebookresearch/detectron2/blob/main/detectron2/evaluation/coco_evaluation.py) for evaluating mask-only results.\n\n### FLOPs and Parameters\n\nThe [`get_flops.py`](tools/get_flops.py) is built based on `detectron2` and `fvcore`. \n\n```bash\npython tools/get_flops.py --config-file \u003cCONFIG\u003e --tasks parameter flop\n```\n\n### Visualizing Images with SparseInst\n\nTo inference or visualize the segmentation results on your images, you can run:\n\n```bash\npython demo.py --config-file \u003cCONFIG\u003e --input \u003cIMAGE-PATH\u003e --output results --opts MODEL.WEIGHTS \u003cMODEL-PATH\u003e\n# example\npython demo.py --config-file configs/sparse_inst_r50_giam.yaml --input datasets/coco/val2017/* --output results --opt MODEL.WEIGHTS sparse_inst_r50_giam_aug_2b7d68.pth INPUT.MIN_SIZE_TEST 512\n```\n* Besides, the `demo.py` also supports inference on video (`--video-input`), camera (`--webcam`). For inference on video, you might refer to [issue #9](https://github.com/hustvl/SparseInst/issues/9) to avoid someerrors.\n* `--opts` supports modifications to the config-file, *e.g.,* `INPUT.MIN_SIZE_TEST 512`.\n* `--input` can be single image or a folder of images, *e.g.,* `xxx/*`.\n* If `--output` is not specified, a popup window will show the visualization results for each image.\n* Lowering the `confidence-threshold` will show more instances but with more false positives.\n\n\u003cdiv\u003e\n\u003ctable align=\"center\"\u003e\n\u003ctd\u003e\u003cimg src=\"assets/figures/000000006471.jpg\" height=200\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cimg src=\"assets/figures/000000014439.jpg\" height=200\u003e\u003c/td\u003e\n\u003c/table\u003e\n\u003cspan\u003e\u003cp align=\"center\"\u003eVisualization results (SparseInst-R50-GIAM)\u003c/p\u003e\u003c/span\u003e\n\u003c/div\u003e\n\n\n### Training SparseInst\n\nTo train the SparseInst model on COCO dataset with 8 GPUs. 8 GPUs are required for the training. If you only have 4 GPUs or GPU memory is limited, it doesn't matter and you can reduce the batch size through `SOLVER.IMS_PER_BATCH` or reduce the input size. If you adjust the batch size, learning schedule should be adjusted according to the linear scaling rule.\n\n```bash\npython tools/train_net.py --config-file \u003cCONFIG\u003e --num-gpus 8 \n# example\npython tools/train_net.py --config-file configs/sparse_inst_r50vd_dcn_giam_aug.yaml --num-gpus 8\n```\n\n\n\u003c!-- ### ONNX Export --\u003e\n\n\n### Custom Training of SparseInst\n\n1. We suggest you convert your custom datasets into the `COCO` format, which enables the usage of the default dataset mappers and loaders. You may find more details in the [official guide of detectron2](https://detectron2.readthedocs.io/en/latest/tutorials/datasets.html#register-a-coco-format-dataset).\n2. You need to check whether `NUM_CLASSES` and `NUM_MASKS` should be changed according to your scenarios or tasks.\n3. Change the configurations accordingly.\n4. After finishing the above procedures, you can easily train SparseInst by `train_net.py`.\n\n\n## Acknowledgements\n\nSparseInst is based on [detectron2](https://github.com/facebookresearch/detectron2), [OneNet](https://github.com/PeizeSun/OneNet), [DETR](https://github.com/facebookresearch/detr), and [timm](https://github.com/rwightman/pytorch-image-models), and we sincerely thanks for their code and contribution to the community!\n\n\n## Citing SparseInst\n\nIf you find SparseInst is useful in your research or applications, please consider giving us a star \u0026#127775; and citing SparseInst by the following BibTeX entry.\n\n```BibTeX\n@inproceedings{Cheng2022SparseInst,\n  title     =   {Sparse Instance Activation for Real-Time Instance Segmentation},\n  author    =   {Cheng, Tianheng and Wang, Xinggang and Chen, Shaoyu and Zhang, Wenqiang and Zhang, Qian and Huang, Chang and Zhang, Zhaoxiang and Liu, Wenyu},\n  booktitle =   {Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR)},\n  year      =   {2022}\n}\n\n```\n\n\n## License\n\nSparseInst is released under the [MIT Licence](LICENCE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustvl%2Fsparseinst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhustvl%2Fsparseinst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustvl%2Fsparseinst/lists"}