keras-team / keras-cv

Industry-strength Computer Vision workflows with Keras
Other
1k stars 332 forks source link

YOLOV8Detector.from_preset docstring is incorrect #1986

Open blair-ahlquist opened 1 year ago

blair-ahlquist commented 1 year ago

I get a TypeError when calling YOLOV8Detector.from_preset:


TypeError Traceback (most recent call last) Cell In[4], line 1 ----> 1 model = keras_cv.models.YOLOV8Detector.from_preset("resnet50_imagenet") 3 println(model)

File c:\Users\Blair\AppData\Local\Programs\Python\Python39\lib\site-packages\keras_cv\models\task.py:189, in Task.__init_subclass__..from_preset(calling_cls, *args, kwargs) 188 def from_preset(calling_cls, *args, *kwargs): --> 189 return super(cls, calling_cls).from_preset(args, kwargs)

File c:\Users\Blair\AppData\Local\Programs\Python\Python39\lib\site-packages\keras_cv\models\task.py:136, in Task.from_preset(cls, preset, load_weights, kwargs) 132 backbone_cls = keras.saving.get_registered_object( 133 metadata["class_name"] 134 ) 135 backbone = backbone_cls.from_preset(preset, load_weights) --> 136 return cls(backbone, kwargs) 138 # Otherwise must be one of class presets 139 config = metadata["config"]

TypeError: init() missing 2 required positional arguments: 'num_classes' and 'bounding_box_format'

jbischof commented 1 year ago

@blair-ahlquist you need to provide those two arguments along with the preset name to fully specify the model architecture. See our OD guide for more details.

blair-ahlquist commented 1 year ago

Ok. I was following the example listed here.

jbischof commented 1 year ago

Good point, we should update the docstring! Feel free to submit a PR or we will get to it eventually.

ianstenbit commented 1 year ago

Thanks for finding this issue! Ramesh is going to update the docstring