Skip to content

Commit

Permalink
make sure dataset meta loaded successfully so that vis is with label
Browse files Browse the repository at this point in the history
  • Loading branch information
Chenxiaon Niu committed Oct 16, 2020
1 parent 309c1de commit 046601b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion demo/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import cv2
import torch

from detectron2.data import MetadataCatalog
from detectron2.data import MetadataCatalog, DatasetCatalog
from detectron2.engine.defaults import DefaultPredictor
from detectron2.utils.video_visualizer import VideoVisualizer
from detectron2.utils.visualizer import ColorMode, Visualizer
Expand All @@ -21,6 +21,9 @@ def __init__(self, cfg, instance_mode=ColorMode.IMAGE, parallel=False):
parallel (bool): whether to run the model in different processes from visualization.
Useful since the visualization logic can be slow.
"""
DatasetCatalog.get(
cfg.DATASETS.TRAIN[0] if len(cfg.DATASETS.TRAIN) else "__unused"
)
self.metadata = MetadataCatalog.get(
cfg.DATASETS.TRAIN[0] if len(cfg.DATASETS.TRAIN) else "__unused"
)
Expand Down

0 comments on commit 046601b

Please sign in to comment.