InvalidArgumentError

I try to test YOLO pre-trained model on an image, however I get the error below even though I am writing the same code as in the assignment in Jupyter Notebook:

InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a float tensor but is a int32 tensor [Op:Mul]

Any helps would be appreciated.

Well, perhaps your new inputs are incorrect. The error message is pretty explicit. Have you checked the types of your inputs? It looks like it is unhappy about the second argument to a multiply being an integer instead of a float.

I have completed the assignment correctly and now I try to use the same code in Jupyter Notebook to test the pre-trained model on “test.jpg”. I think I use the type float32 for the inputs. This is the code after importing the necessary libraries (I use the same “predict” function in the assignment):

class_names = read_classes(“model_data/coco_classes.txt”)
anchors = read_anchors(“model_data/yolo_anchors.txt”)
model_image_size = (608, 608) # Same as yolo_model input layer size

yolo_model = load_model(“model_data/yolo.h5”, compile=False)
out_scores, out_boxes, out_classes = predict(“test.jpg”)

Are you running this on the course website or did you download the notebook into some other environment?

I have downloaded the Jupyter workspace files into my PC, and trying to rewrite it in a new Jupyter Notebook.

Then you are on your own. There are no official instructions for doing that. Please realize that all the packages in this space mutate really quickly, so you can’t just assume things will work with whatever random combination of packages you have installed on your system. Here’s a thread from a fellow student with a lot of useful information, but getting this to work is not a trivial matter and requires some good problem solving skills on your part.