Making object detection with tf from fischertechnik

I downloaded the complete repository from https://git.fischertechnik-cloud.com/…ing and installed TensorFlow 2.5.0 (I am using Python 3.9.13, which is recommended in the documentation and on the cloud).

Following the “Documentation Quality Control with AI 9V”, I installed the required packages using requirements.txt. During this process, the TensorFlow version was updated from 2.5.0 to 2.9.3. Keeping TensorFlow at version 2.5.0 resulted in version conflicts that prevented me from training the model, so I proceeded with version 2.9.3.

After successfully installing the required packages, I followed the documentation to the test folder, created, and tested the model - everything worked fine at this stage.

Next, I created a dataset using the script pascal-to-csv.py located in the object_detection folder of the downloaded repository. I have three classes of pucks: pucks with defects, pucks with chamfers, and pucks without defects. I captured 100 images for each class (totaling 300 images) using the Fischertechnik camera on the Robotics Add-On KI/AI sorting line and labeled the images using labelImg.py.

Using the create-model.py script in the object_detection folder, I successfully trained the model. However, when I tried to test the model using the test-image.py script, I encountered an error. The command I used was:

python test-image.py -d “path_to_model_and_labels.txt” -i “path_to_image”

This resulted in an error: “iteration over 0d array” (a screenshot of the error is attached). I tested the model on the same data it was trained on.
Does anyone have the same problem or know how to solve this issue?

1 Like

Hi @Ales_Vacha, The TypeError: iteration over a 0-d array occurs when you try to iterate over a 0-dimensional array. For example,

import numpy as np
zero_dim = np.array(5)
print(zero_dim.ndim) #output: 0

for i in zero_dim:
  print(i)
#output:  TypeError: iteration over a 0-d array

Could you please check the code in the test-image.py file where you might be iterating on 0-dimensional data. Thank You.

I got the same Problem. Did you somehow solved it ?

Yes i did, the problem was in: classes = np.squeeze(interpreter.get_tensor(output_details[3][“index”])), it was a 2, where should be a 3. In test-image.py.

1 Like

well did it worked after that on your ft sorting-line as well ?

No, u need to make your custom procces image in ROBO PRO.

1 Like

1 Like

1 Like

Do you have discord? It would be so helpful to talk with you for a sec…:smiley: