googlecolab / colabtools

Python libraries for Google Colaboratory
Apache License 2.0
2.17k stars 706 forks source link

visualization.plot_bounding_box_gallery() : Type error #3998

Closed roversi closed 1 year ago

roversi commented 1 year ago

In the "Object Detection with KerasCV" example , the visualization.plot_bounding_box_gallery() function is presenting an TypeError:

/usr/local/lib/python3.10/dist-packages/keras_cv/visualization/plot_bounding_box_gallery.py in plot_bounding_box_gallery(images, value_range, bounding_box_format, y_true, y_pred, true_color, pred_color, line_thickness, font_scale, text_thickness, class_mapping, ground_truth_mapping, prediction_mapping, legend, legend_handles, rows, cols, **kwargs) 125 plotted_images = utils.to_numpy(images) 126 --> 127 draw_fn = functools.partial( 128 draw_bounding_boxes, 129 bounding_box_format="xyxy",

TypeError: the first argument must be callable

It was expected to display a image and the predicted bounding boxes with classes names....

henrisve commented 1 year ago

downgrade KerasCV to 0.6.2 and it will work

roversi commented 1 year ago

After downgrading KerasCV to 0.6.2, keras_cv.layers.Resizing() has not worked anymore...


/usr/local/lib/python3.10/dist-packages/keras_cv/src/layers/preprocessing/resizing.py in init(self, height, width, interpolation, crop_to_aspect_ratio, pad_to_aspect_ratio, bounding_box_format, **kwargs) 92 self.crop_to_aspect_ratio = crop_to_aspect_ratio 93 self.pad_to_aspect_ratio = pad_to_aspect_ratio ---> 94 self._interpolation_method = keras_cv.utils.get_interpolation( 95 interpolation 96 )

AttributeError: module 'kerascv' has no attribute 'utils'


I just tried to run everything from the beggining again using the updated keras-cv as the the original example and it worked!! I don't know if something was fixed in the background or whatever....

Thanks for your support!