-
Notifications
You must be signed in to change notification settings - Fork 10
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
Added Zero shot instance segmentation #19
Open
f2010126
wants to merge
3
commits into
DagsHub:main
Choose a base branch
from
f2010126:Zero-shot-Instance-Segmentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
|
||
# Code for CVPR2021 paper | ||
|
||
# **Zero-shot Instance Segmentation** | ||
|
||
## Code requirements | ||
+ python: python3.7 | ||
+ nvidia GPU | ||
+ pytorch1.1.0 | ||
+ GCC >=5.4 | ||
+ NCCL 2 | ||
+ the other python libs in requirement.txt | ||
|
||
## Install | ||
|
||
``` | ||
conda create -n zsi python=3.7 -y | ||
conda activate zsi | ||
|
||
conda install pytorch=1.1.0 torchvision=0.3.0 cudatoolkit=10.0 -c pytorch | ||
|
||
pip install cython && pip --no-cache-dir install -r requirements.txt | ||
|
||
python setup.py develop | ||
``` | ||
|
||
## Dataset prepare | ||
|
||
|
||
- Download the train and test annotations files for zsi from [annotations](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/data/coco/annotations), put all json label file to | ||
``` | ||
data/coco/annotations/ | ||
``` | ||
|
||
- Download MSCOCO-2014 dataset and unzip the images it to path: | ||
``` | ||
data/coco/train2014/ | ||
data/coco/val2014/ | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
- **Training**: | ||
- 48/17 split: | ||
``` | ||
chmod +x tools/dist_train.sh | ||
./tools/dist_train.sh configs/zsi/train/zero-shot-mask-rcnn-BARPN-bbox_mask_sync_bg_decoder.py 4 | ||
``` | ||
|
||
- 65/15 split: | ||
``` | ||
chmod +x tools/dist_train.sh | ||
./tools/dist_train.sh configs/zsi/train/zero-shot-mask-rcnn-BARPN-bbox_mask_sync_bg_65_15_decoder_notanh.py 4 | ||
``` | ||
|
||
- **Inference & Evaluate**: | ||
|
||
+ **ZSI task**: | ||
|
||
- 48/17 split ZSI task: | ||
- download [48/17](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/checkpoints) ZSI model, put it in checkpoints/ZSI_48_17.pth | ||
|
||
- inference: | ||
``` | ||
chmod +x tools/dist_test.sh | ||
./tools/dist_test.sh configs/zsi/48_17/test/zsi/zero-shot-mask-rcnn-BARPN-bbox_mask_sync_bg_decoder.py checkpoints/ZSI_48_17.pth 4 --json_out results/zsi_48_17.json | ||
``` | ||
- our results zsi_48_17.bbox.json and zsi_48_17.segm.json can also downloaded from [zsi_48_17_reults](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/results). | ||
- evaluate: | ||
- for zsd performance | ||
``` | ||
python tools/zsi_coco_eval.py results/zsi_48_17.bbox.json --ann data/coco/annotations/instances_val2014_unseen_48_17.json | ||
``` | ||
- for zsi performance | ||
``` | ||
python tools/zsi_coco_eval.py results/zsi_48_17.segm.json --ann data/coco/annotations/instances_val2014_unseen_48_17.json --types segm | ||
``` | ||
- 65/15 split ZSI task: | ||
- download [65/15](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/checkpoints) ZSI model, put it in checkpoints/ZSI_65_15.pth | ||
|
||
- inference: | ||
``` | ||
chmod +x tools/dist_test.sh | ||
./toools/dist_test.sh configs/zsi/65_15/test/zsi/zero-shot-mask-rcnn-BARPN-bbox_mask_sync_bg_65_15_decoder_notanh.py checkpoints/ZSI_65_15.pth 4 --json_out results/zsi_65_15.json | ||
``` | ||
- our results zsi_65_15.bbox.json and zsi_65_15.segm.json can also downloaded from [zsi_65_15_reults](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/results). | ||
- evaluate: | ||
- for zsd performance | ||
``` | ||
python tools/zsi_coco_eval.py results/zsi_65_15.bbox.json --ann data/coco/annotations/instances_val2014_unseen_65_15.json | ||
``` | ||
- for zsi performance | ||
``` | ||
python tools/zsi_coco_eval.py results/zsi_65_15.segm.json --ann data/coco/annotations/instances_val2014_unseen_65_15.json --types segm | ||
``` | ||
|
||
+ **GZSI task**: | ||
|
||
- 48/17 split GZSI task: | ||
- use the same model file ZSI_48_17.pth in ZSI task | ||
- inference: | ||
``` | ||
chmod +x tools/dist_test.sh | ||
./tools/dist_test.sh configs/zsi/48_17/test/gzsi/zero-shot-mask-rcnn-BARPN-bbox_mask_sync_bg_decoder_gzsi.py checkpoints/ZSI_48_17.pth 4 --json_out results/gzsi_48_17.json | ||
``` | ||
- our results gzsi_48_17.bbox.json and gzsi_48_17.segm.json can also downloaded from [gzsi_48_17_results](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/results). | ||
- evaluate: | ||
- for gzsd | ||
``` | ||
python tools/gzsi_coco_eval.py results/gzsi_48_17.bbox.json --ann data/coco/annotations/instances_val2014_gzsi_48_17.json --gzsi --num-seen-classes 48 | ||
``` | ||
- for gzsi | ||
``` | ||
python tools/gzsi_coco_eval.py results/gzsi_48_17.segm.json --ann data/coco/annotations/instances_val2014_gzsi_48_17.json --gzsi --num-seen-classes 48 --types segm | ||
``` | ||
- 65/15 split GZSI task: | ||
- use the same model file ZSI_48_17.pth in ZSI task | ||
- inference: | ||
``` | ||
chmod +x tools/dist_test.sh | ||
./tools/dist_test.sh configs/zsi/65_15/test/gzsi/zero-shot-mask-rcnn-BARPN-bbox_mask_sync_bg_65_15_decoder_notanh_gzsi.py checkpoints/ZSI_65_15.pth 4 --json_out results/gzsi_65_15.json | ||
``` | ||
- our results gzsi_65_15.bbox.json and gzsi_65_15.segm.json can also downloaded from [gzsi_65_15_results](https://dagshub.com/f2010126/Zero-shot-Instance-Segmentation/src/main/results). | ||
- evaluate: | ||
- for gzsd | ||
``` | ||
python tools/gzsi_coco_eval.py results/gzsi_65_15.bbox.json --ann data/coco/annotations/instances_val2014_gzsi_65_15.json --gzsd --num-seen-classes 65 | ||
``` | ||
- for gzsi | ||
``` | ||
python tools/gzsi_coco_eval.py results/gzsi_65_15.segm.json --ann data/coco/annotations/instances_val2014_gzsi_65_15.json --gzsd --num-seen-classes 65 --types segm | ||
``` | ||
|
||
|
||
# License | ||
|
||
ZSI is released under MIT License. | ||
|
||
|
||
## Citing | ||
|
||
If you use ZSI in your research or wish to refer to the baseline results published here, please use the following BibTeX entries: | ||
|
||
```BibTeX | ||
|
||
@InProceedings{Zheng_2021_CVPR, | ||
author = {Zheng, Ye and Wu, Jiahong and Qin, Yongqiang and Zhang, Faen and Cui, Li}, | ||
title = {Zero-Shot Instance Segmentation}, | ||
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, | ||
month = {June}, | ||
year = {2021}, | ||
pages = {2593-2602} | ||
} | ||
|
||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a link to the DagsHub repository here.