autodistill/autodistill-codet

ModuleNotFoundError: No module named 'detectron2'

Rivoks opened this issue · 0 comments

Hello,

I am trying to install the CO-Det implementation with Autodistill. I had installed autodistill with the given command-line in the the documentation:

pip install autodistill autodistill-grounded-sam autodistill-yolov8

I am running the following demo script:

from autodistill_codet import CoDet
from autodistill.detection import CaptionOntology
from autodistill.utils import plot
import cv2

base_model = CoDet(ontology=CaptionOntology({"person": "person"}))

image_path = "../my-img.jpg"
predictions = base_model.predict(image_path)
image = cv2.imread(image_path)

plot(image=image, detections=predictions, classes=base_model.class_names)

I am getting the following error:

Traceback (most recent call last):
  File "/home/xx/Desktop/auto-labeling-models-evaluation/codet/preview.py", line 1, in <module>
    from autodistill_codet import CoDet
  File "/home/xx/miniconda3/envs/autodistill/lib/python3.11/site-packages/autodistill_codet/__init__.py", line 1, in <module>
    from autodistill_codet.codet_model import CoDet
  File "/home/xx/miniconda3/envs/autodistill/lib/python3.11/site-packages/autodistill_codet/codet_model.py", line 86, in <module>
    import detectron2.utils.comm as comm
ModuleNotFoundError: No module named 'detectron2'

I already tried to install detectron2 separately but the CO-Det install overwrite it anyaway.

Thank you for your help,
Rivoks