SaschaDittmann / tfjs-cv-objectdetection

TensorFlow.js Example: Using an Azure Custom Vision Object Detection model to detect Logos in a web browser
MIT License
14 stars 6 forks source link

Unable to make prediction #7

Open bachmid-adib opened 3 years ago

bachmid-adib commented 3 years ago

Thanks for this tutorial. But when I tried it, your model never loaded successfully. And when I switched to my model, the loading was successful. But when I do predictions, predictions never work, and when I look at the web console, I get the error "_backendwebgl.js:174 Activation leakyrelu has not been implemented for the WebGL backend". Then I tried to adjust the tensorflowjs version in html

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js"></script>

with the version I used when converting the model, but then I got an error in the web console "Shapes can _utilbase.js: 357 not be <0. Found -2 at dim 2".

Can you help me? I don't know the problem, is it because my model is too big? Because my model reaches 61 bin files.

SaschaDittmann commented 3 years ago

Hi! About using my model: I use Git LFS to store my bin files in this repo. If you download my repo a zip file, those files will be broken. You need to either clone my repo or download those files individually.

Some questions about your own model: Did you generate your model using Azure Custom Vision or did you train it using other tools or code? 61 bin files is pretty large. Did you check the developer tools in you browser, if the model can be loaded or is running out of memory?

bachmid-adib commented 3 years ago

oh okay, I will try to clone your repo. Thanks for your information.

No, I don't use Azure Custom Vision for my model, because I already have tensorflow model with YOLOv4. So basically, I just convert my tensorflow model to tensorflow.js and then apply it to your web-app repo. And yes, I already check in my browser console, the model loaded pretty well. The problem is when I start to predict the image. You can look at the image below for detail image

SaschaDittmann commented 3 years ago

Did you also change the code to fit the input and output shapes of your model? You also don't need to do the post processing, since this code is build specifically for Azure Custom Vision.

bachmid-adib commented 3 years ago

No, I didn't change anything in the code. I tried changing the ANCHORS variable according to Yolov4, but I got the same error, so I reverted it back to the beginning. I've also tried to turn off the post processing function, but the error I got was the same.

Do I have to change the code according to the model I'm using? If yes, where? Because I have changed the ANCHORS variable but I still get the same error