-
Notifications
You must be signed in to change notification settings - Fork 20
4c Instance segmentation
Hou Yujun edited this page Nov 12, 2024
·
3 revisions
The script inference.py
utilises a Mask2Former model pretrained on the Mapillary Vistas Dataset to perform instance segmentation for each input image, producing both pixel counts from semantic segmentation and instance counts from instance detection, for 65 object categories.
Set up environment with requirements-cv-linux.txt
.
Input
The input CSV should:
- have each row representing an image to process, and
- contain minimally two columns, named
uuid
andpath
, to specify image UUID and the local image file path, respectively
Output
Two CSVs:
-
segmentation.csv
for pixel counts from semantic segmentation -
instances.csv
for for instance counts from instance detection
To reproduce output in sample_output
Simply modify out_Folder
(path to the folder to store output CSVs) in inference.py
, then run
python3 inference.py
Modify inference.py
:
- Modify
out_Folder
to the directory you wish to store the output CSVs - Modify
in_Path
to the path of your input CSV
Run:
python3 inference.py
This part of our work is based on models from facebook/mask2former-swin-large-mapillary-vistas-panoptic by Cheng et al. (2022).