Skip to content

Commit

Permalink
add colab demo
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyizhou committed Apr 21, 2022
1 parent 3874f15 commit e61fe09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ See [installation instructions](docs/INSTALL.md).

## Demo

Run our demo using Colab (no GPU needed): [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1vW1sSQc0daGSNjdBXdD-wFEPKT27qwDe)


We use the default detectron2 [demo interface](https://github.com/facebookresearch/detectron2/blob/main/GETTING_STARTED.md). For example, to run [TAO model](configs/GTR_TAO_DR2101.yaml) on an example video (video source: TAO/YFCC100M dataset), download the [model](https://drive.google.com/file/d/1TqkLpFZvOMY5HTTaAWz25RxtLHdzQ-CD/view?usp=sharing) and run

~~~
Expand Down
5 changes: 3 additions & 2 deletions gtr/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from detectron2.data import MetadataCatalog
from detectron2.engine.defaults import DefaultPredictor
from detectron2.utils.video_visualizer import VideoVisualizer, random_colors
from detectron2.utils.video_visualizer import VideoVisualizer, random_color
from detectron2.utils.video_visualizer import _create_text_labels
from detectron2.utils.visualizer import ColorMode, Visualizer

Expand All @@ -23,7 +23,8 @@ def __init__(self, metadata, instance_mode=ColorMode.IMAGE):
self._assigned_colors = {}
self._max_num_instances = 10000
self._num_colors = 74
self._color_pool = random_colors(self._num_colors, rgb=True, maximum=1)
self._color_pool = [random_color(rgb=True, maximum=1) \
for _ in range(self._num_colors)]
self.color_idx = 0


Expand Down

0 comments on commit e61fe09

Please sign in to comment.