Computer Vision News - October 2021
3 Summary 1 Creating a multi-object tracking model... Create Model and Load Trained Weights # Create model object in inference mode. model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=confi g) # Load weights trained on MS-COCO model.load_weights(COCO_MODEL_PATH, by_name=True) Class Names The model classifies objects and returns class IDs, which are integer value that identify each class. Some datasets assign integer values to their classes and some don't. For example, in the MS-COCO dataset, the 'person' class is 1 and 'teddy bear' is 88. The IDs are often sequential, but not always. The COCO dataset, for example, has classes associated with class IDs 70 and 72, but not 71. To improve consistency, and to support training on data from multiple sources at the same time, our Dataset class assigns its own sequential integer IDs to each class. For example, if you load the COCO dataset using our Dataset class, the 'person' class would get class ID = 1 (just like COCO) and the 'teddy bear' class is 78 (different from COCO). Keep that in mind when mapping class IDs to class names. To get the list of class names, you'd load the dataset and then use the class_ names property like this. # Load COCO dataset dataset = coco.CocoDataset() dataset.load_coco(COCO_DIR, "train") dataset.prepare() # Print class names print(dataset.class_names) Youwon't need to download the COCOdataset just to run this demo!We are including the list of class names below. The index of the class name in the list represents its ID (first class is 0, second is 1, third is 2, ...etc.)
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=