Skip to content

Commit 118ffab

Browse files
Merge pull request #22 from ppwwyyxx/master
Make panopticapi a package
2 parents 8a32c19 + 5298a2c commit 118ffab

12 files changed

+39
-20
lines changed

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# COCO 2018 Panoptic Segmentation Task API (Beta version)
22
This API is an experimental version of [COCO 2018 Panoptic Segmentation Task API](http://cocodataset.org/#panoptic-2018).
33

4+
To install panopticapi, run:
5+
```
6+
pip install git+https://github.com/cocodataset/panopticapi.git
7+
```
8+
49
## Summary
510
**Evaluation script**
611

7-
*evaluation.py* calculates [PQ metrics](http://cocodataset.org/#panoptic-eval). For more information about the script usage: `python evaluation.py --help`
12+
[panopticapi/evaluation.py](panopticapi/evaluation.py) calculates [PQ metrics](http://cocodataset.org/#panoptic-eval).
13+
For more information about the script usage: `python -m panopticapi.evaluation --help`
814

915
**Format converters**
1016

@@ -14,17 +20,21 @@ We provide several converters for COCO panoptic format. Full description and usa
1420

1521
**Semantic and instance segmentation heuristic combination**
1622

17-
We provide simple script that heuristically combines semantic and instance segmentation predictions into panoptic segmentation prediction.
23+
We provide [a simple script](panopticapi/combine_semantic_and_instance_predictions.py)
24+
that heuristically combines semantic and instance segmentation predictions into panoptic segmentation prediction.
25+
26+
The merging logic of the script is described in the panoptic segmentation [paper](https://arxiv.org/abs/1801.00868).
27+
In addition, this script is able to filter out stuff predicted segments that have their area below the threshold defined by `--stuff_area_limit` parameter.
1828

19-
The merging logic of the script is described in the panoptic segmentation [paper](https://arxiv.org/abs/1801.00868). In addition, this script is able to filter out stuff predicted segments that have their area below the threshold defined by `--stuff_area_limit` parameter. For more information about the script logic and usage: `python combine_semantic_and_instance_predictions.py --help`
29+
For more information about the script logic and usage: `python -m panopticapi.combine_semantic_and_instance_predictions.py --help`
2030

2131
**COCO panoptic segmentation challenge categories**
2232

23-
Json file [panoptic_coco_categories.json](https://github.com/cocodataset/panopticapi/blob/master/panoptic_coco_categories.json) contains the list of all categories used in COCO panoptic segmentation challenge 2018.
33+
Json file [panoptic_coco_categories.json](panoptic_coco_categories.json) contains the list of all categories used in COCO panoptic segmentation challenge 2018.
2434

2535
**Visualization**
2636

27-
*visualization.py* provides an example of generating visually appealing representation of the panoptic segmentation data.
37+
[visualization.py](visualization.py) provides an example of generating visually appealing representation of the panoptic segmentation data.
2838

2939
## Contact
3040
If you have any questions regarding this API, please contact us at alexander.n.kirillov-at-gmail.com.

cityscapes_gt_converter/cityscapes_panoptic_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import numpy as np
1010
import PIL.Image as Image
1111

12-
from utils import IdGenerator, save_json
12+
from panopticapi.utils import IdGenerator, save_json
1313

1414
try:
1515
# set up path for cityscapes scripts

converters/2channels2panoptic_coco_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
import PIL.Image as Image
3232

33-
from utils import get_traceback, IdGenerator, save_json
33+
from panopticapi.utils import get_traceback, IdGenerator, save_json
3434

3535
OFFSET = 1000
3636

converters/detection2panoptic_coco_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import PIL.Image as Image
1919

20-
from utils import get_traceback, IdGenerator, save_json
20+
from panopticapi.utils import get_traceback, IdGenerator, save_json
2121

2222
try:
2323
# set up path for pycocotools

converters/panoptic2detection_coco_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import PIL.Image as Image
2323

24-
from utils import get_traceback, rgb2id, save_json
24+
from panopticapi.utils import get_traceback, rgb2id, save_json
2525

2626
try:
2727
# set up path for pycocotools

converters/panoptic2semantic_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import PIL.Image as Image
2323

24-
from utils import get_traceback, rgb2id, save_json
24+
from panopticapi.utils import get_traceback, rgb2id, save_json
2525

2626
try:
2727
# set up path for pycocotools
File renamed without changes.

combine_semantic_and_instance_predictions.py renamed to panopticapi/combine_semantic_and_instance_predictions.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,11 @@
2121
import multiprocessing
2222
import copy
2323

24-
from utils import IdGenerator, id2rgb, save_json
24+
from panopticapi.utils import IdGenerator, id2rgb, save_json
2525

26-
try:
27-
import PIL.Image as Image
28-
except Exception:
29-
print("Failed to import the image processing packages.")
30-
sys.exit(-1)
26+
import PIL.Image as Image
3127

3228
try:
33-
# set up path for pycocotools
34-
# sys.path.append('./cocoapi-master/PythonAPI/')
3529
from pycocotools import mask as COCOmask
3630
except Exception:
3731
raise Exception("Please install pycocotools module from https://github.com/cocodataset/cocoapi")

evaluation.py renamed to panopticapi/evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import PIL.Image as Image
1616

17-
from utils import get_traceback, rgb2id
17+
from panopticapi.utils import get_traceback, rgb2id
1818

1919
OFFSET = 256 * 256 * 256
2020
VOID = 0
File renamed without changes.

0 commit comments

Comments
 (0)