luojianbin2006 / seg2coco

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segmentations to COCO Annotation

When there are many files, it is recommended to write to the file every time a picture is processed

Usage

seg2coco.py

  • inst_dir: The directory of instance segmentation images.

  • sem_dir: The directory of semantic segmentation images.

  • categories: Assign category according to the value in semantic segmentation.

    categories = [
        {"id": 1, "name": "cube", "supercategory": "object"},
        {"id": 2, "name": "monkey", "supercategory": "object"},
    ]  
  • json_filepath: Result annotations in json.

    Find Contours

    1. skimage.measure.find_contours: Highest accuracy, but takes up a lot of space.

    2. cv2.findContours Method Detail

      • cv2.CHAIN_APPROX_NONE: Second accuracy.

      • cv2.CHAIN_APPROX_SIMPLE: Third accuracy.

      • cv2.CHAIN_APPROX_TC89_L1: Fourth accuracy.

      • cv2.CHAIN_APPROX_TC89_KCOS: Lowest accuracy, but save space.


    Compare


show_anns.py

Cube Monkey

About


Languages

Language:Python 100.0%