iTranslated by AI
Object Detection and Segmentation with Detic
I have summarized my confirmation of the object detection model Detic running in a local environment, based on the following repository. The official implementation is as follows. Semantic segmentation is also implemented in the repository, and the results can be checked together.
What is Detic?
Meta research reported this object detection model at ECCV 2022. The source is as follows.
we propose Detector with image classes (Detic) that uses image-level supervision in addition to detection supervision. We observe that the localization and classification sub-problems can be decoupled.
[Detecting Twenty-thousand Classes using Image-level Supervision, arXiv, 2022]
I understand this as a method that interprets the object detection task as being defined by localization and class prediction, and learns them by decoupling them. Specifically, it learns the localization function from datasets with bounding box information such as COCO, and then learns the class prediction function from datasets that only have class information, such as ImageNet-21k, by using the object rectangles predicted by the acquired localization part as input.
Previously, there was a limit to the number of classes that could be detected because localization and class prediction were learned from the same dataset. The proposed method improves this so that image recognition datasets can be incorporated into class prediction, expanding the detection classes to more than 20,000 classes.
Open-vocabulary object detection, or also named zero-shot object de-
tection, aims to detect objects outside of the training vocabulary.
Detecting Twenty-thousand Classes using Image-level Supervision, arXiv, 2022
Additionally, it addresses object detection tasks for classes not included in the training data (zero-shot object detection). By replacing the output class prediction part with CLIP—a classification model that learns by associating image features with linguistic features—and training them simultaneously, classification for arbitrary classes is possible.
I will omit the explanation for zero-shot object detection as it deviates from the main topic and also because of my own lack of study. I have listed articles that investigate zero-shot object detection in the reference section, so please refer to them.
Operating Environment
- Ubuntu 20.04
- Python3.8.10
- NVIDIA GeForce RTX 3080 laptop GPU
- torch==1.12.1+cu113
Environment Setup
mkdir ./detic
git clone git@github.com:facebookresearch/detectron2.git
cd detectron2
pip install -e .
cd ..
git clone https://github.com/facebookresearch/Detic.git --recurse-submodules
cd Detic
pip install -r requirements.txt
Execution
Place the image image.png you want to detect in the same directory as demo.py.
Run the command from the Demo section of the README.md in the repository.
mkdir models
wget https://dl.fbaipublicfiles.com/detic/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth -O models/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth
python3 demo.py --config-file configs/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.yaml --input image.png --output out.png --vocabulary lvis --opts MODEL.WEIGHTS models/Detic_LCOCOI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.pth
Operation Check
I reproduced a driving scene using the car simulator Carla. This time, I will perform object detection using this image. Although the model was trained on real-world objects, I will see if it can correctly detect objects in a simulator image.

Image of a reproduced driving scene using Carla
Here are the results of object detection and segmentation.

Object detection + segmentation results by Detic
Roads and buildings do not seem to be detected, likely because they are not in the detection classes, but other objects are detected without omission. Although the segmentation accuracy is low, for this use case, it is fine as long as there are no detection misses. It was confirmed that the object detector functions sufficiently even on simulator images.
Summary
I have confirmed the inference of the Detic model, reported by Meta research at ECCV 2022, in a local environment. I felt that its performance as an object detector is exceptionally high. Additionally, it was very educational to learn that for typical image processing tasks like object detection, models like CLIP—which learn by linking images and language—can be an effective approach when considering compatibility with unknown classes.
References
Detic is introduced in the following article. It served as the inspiration and reference for this article, so please take a look at it as well.
The following article introduces ViDL, a method mentioned in the Detic paper as a reference for the implementation of zero-shot object detection. Please take a look at this as well.
A research trend in zero-shot object detection, published by the same author as the article above, is also introduced. Please check this out as well.
Discussion