Importing images with COCO annotations

Images with Common Objects in Context (COCO) annotations are images that were labeled outside of IBM® Maximo® Visual Inspection.

About this task

You can import, or upload, these images into an existing IBM Maximo Visual Inspection data set along with the COCO annotation file to inter-operate with other collections of information and to ease your labeling effort.

Only object detection annotations are supported. You can review the annotation format on the COCO data format page. When you import images that have COCO annotations, IBM Maximo Visual Inspection keeps only the information that it plans to use:

  • IBM Maximo Visual Inspection extracts the information from the images, categories, and annotations lists and ignores everything else.
  • Unused annotations are not saved. For example, if an annotation for clock was created, but no image is tagged with a clock, then the clock object, which is called category in COCO, is not saved.
  • For COCO annotations that use the RLE format, the entire annotation is ignored.
Note: Images without tags are saved.

Procedure

  1. If necessary, create a new data set. The data set must exist before you import the COCO annotated data.
  2. Download the images that you want to import.
  3. If you downloaded train2017.zip, IBM Maximo Visual Inspection cannot train the entire data set. Therefore, you must make a new file that contains just the images you want to train, for example, by running this command:
    ls train2017 | grep jpg | head -20000 >/tmp/flist
  4. Download the annotations file for your images. For example, annotations_trainval2017.zip contains the annotations for the train2017 data set. For example, if you downloaded annotations_trainval2017.zip, extract the annotations/instances_train2017.json file, which is the COCO annotation file for object detection.If you are using a .json file from a different source, it cannot be called prop.json.
  5. Create a .zip file that contains the annotations file and the images.
    • The .zip file can contain only one .json file. If more that one .json file is discovered, only the first one is used.
    • The .json file cannot be named props.json because this name is used by IBM Maximo Visual Inspection exported data sets, which use different annotations.
    • The images and the annotation file can be stored in different directories.
  6. Import the .zip file into an existing IBM Maximo Visual Inspection data set.
    Note: COCO data sets are created for competition and designed to be challenging to identify objects. The accuracy numbers that are achieved when training are relatively low, especially with the default 4000 iterations. However, you can use these data sets to experiment with segmentation training and inference without having to manually label many images.

    For more information about COCO data sets, see the COCO website.