Spaces:
Runtime error
Runtime error
Ivan Felipe Rodriguez
commited on
Commit
•
03ba546
1
Parent(s):
9fdb241
adding colors to palette
Browse files- inference.py +6 -0
inference.py
CHANGED
@@ -86,6 +86,7 @@ register_all_modules()
|
|
86 |
|
87 |
# build the model from a config file and a checkpoint file
|
88 |
model = init_detector(config_file, checkpoint_file, device='cuda:0') # or device='cuda:0'
|
|
|
89 |
model.dataset_meta['classes'] = classes
|
90 |
print(model.cfg.visualizer)
|
91 |
# init visualizer(run the block only once in jupyter notebook)
|
@@ -94,6 +95,11 @@ print(dir(visualizer))
|
|
94 |
# the dataset_meta is loaded from the checkpoint and
|
95 |
# then pass to the model in init_detector
|
96 |
visualizer.dataset_meta = model.dataset_meta
|
|
|
|
|
|
|
|
|
|
|
97 |
def inference_frame_serial(image):
|
98 |
start = time()
|
99 |
result = inference_detector(model, image)
|
|
|
86 |
|
87 |
# build the model from a config file and a checkpoint file
|
88 |
model = init_detector(config_file, checkpoint_file, device='cuda:0') # or device='cuda:0'
|
89 |
+
model.dataset_meta['palette'] = model.dataset_meta['palette'] + model.dataset_meta['palette'][:23]
|
90 |
model.dataset_meta['classes'] = classes
|
91 |
print(model.cfg.visualizer)
|
92 |
# init visualizer(run the block only once in jupyter notebook)
|
|
|
95 |
# the dataset_meta is loaded from the checkpoint and
|
96 |
# then pass to the model in init_detector
|
97 |
visualizer.dataset_meta = model.dataset_meta
|
98 |
+
classes = visualizer.dataset_meta.get('classes', None)
|
99 |
+
palette = visualizer.dataset_meta.get('palette', None)
|
100 |
+
|
101 |
+
print(len(classes))
|
102 |
+
print(len(palette))
|
103 |
def inference_frame_serial(image):
|
104 |
start = time()
|
105 |
result = inference_detector(model, image)
|