roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
4.89k stars 759 forks source link

cannot import name 'sync_analytics' from 'ultralytics.hub.utils' #111

Closed anhay1999 closed 1 year ago

anhay1999 commented 1 year ago

Search before asking

Notebook name

In the "how-to-track-and-count-vehicles-with-yolov8.ipynb", when I run this block, I met an error:

`

create frame generator

generator = get_video_frames_generator(SOURCE_VIDEO_PATH)

create instance of BoxAnnotator

box_annotator = BoxAnnotator(color=ColorPalette(), thickness=4, text_thickness=4, text_scale=2)

acquire first video frame

iterator = iter(generator) frame = next(iterator)

model prediction on single frame and conversion to supervision Detections

results = model(frame) detections = Detections( xyxy=results[0].boxes.xyxy.cpu().numpy(), confidence=results[0].boxes.conf.cpu().numpy(), class_id=results[0].boxes.cls.cpu().numpy().astype(int) )

format custom labels

labels = [ f"{CLASS_NAMES_DICT[classid]} {confidence:0.2f}" for , confidence, class_id, tracker_id in detections ]

annotate and display frame

frame = box_annotator.annotate(frame=frame, detections=detections, labels=labels)

%matplotlib inline show_frame_in_notebook(frame, (16, 16)) `

Bug


ImportError Traceback (most recent call last) in <cell line: 9>() 7 frame = next(iterator) 8 # model prediction on single frame and conversion to supervision Detections ----> 9 results = model(frame) 10 detections = Detections( 11 xyxy=results[0].boxes.xyxy.cpu().numpy(),

5 frames /usr/local/lib/python3.10/dist-packages/ultralytics/yolo/engine/model.py in call(self, source, stream, **kwargs) 109 self.model.info(verbose=verbose) 110 --> 111 def fuse(self): 112 self.model.fuse() 113

/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py in decorate_context(*args, kwargs) 113 def decorate_context(*args, *kwargs): 114 with ctx_factory(): --> 115 return func(args, kwargs) 116 117 return decorate_context

/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/engine/model.py in predict(self, source, stream, **kwargs)

/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/engine/predictor.py in init(self, cfg, overrides, _callbacks) 107 108 def setup_source(self, source=None): --> 109 if not self.model: 110 raise Exception("setup model before setting up source!") 111 # source

/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/utils/callbacks/base.py in add_integration_callbacks(instance)

/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/utils/callbacks/hub.py in 4 from time import time 5 ----> 6 from ultralytics.hub.utils import PREFIX, sync_analytics 7 from ultralytics.yolo.utils import LOGGER 8

ImportError: cannot import name 'sync_analytics' from 'ultralytics.hub.utils' (/usr/local/lib/python3.10/dist-packages/ultralytics/hub/utils.py)

Environment

google colab

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @anhay1999, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.