Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classification Issue #52

Open
PotatoAim20 opened this issue Aug 21, 2024 · 17 comments
Open

Classification Issue #52

PotatoAim20 opened this issue Aug 21, 2024 · 17 comments
Labels
bug Something isn't working question Further information is requested

Comments

@PotatoAim20
Copy link

PotatoAim20 commented Aug 21, 2024

No description provided.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working question Further information is requested labels Aug 21, 2024
@glenn-jocher
Copy link
Member

@PotatoAim20 thank you for reaching out. Could you please provide more details about the classification issue you're experiencing? This will help us assist you better.

@sruizhuenei
Copy link

sruizhuenei commented Oct 8, 2024

Hello, I'm trying to use the example to classify images, the yolo model work correct on python, but when I export to ftlite and try to use it in the example for imageClassification nothing happens.

The example have commented the classification part, so I change the comments to the detection part and also change the model name with my model.

Is the imageClassification work? Need I a mlmodel only, or can I use the Classification with tflite files?

Regards!

@pderrenger
Copy link
Member

@sruizhuenei hello! You can use YOLO models for image classification with TFLite files. Ensure your TFLite model is correctly exported and integrated into your application. If issues persist, verify compatibility with the latest version of the package. For more details, check the Ultralytics documentation.

@sruizhuenei
Copy link

@sruizhuenei hello! You can use YOLO models for image classification with TFLite files. Ensure your TFLite model is correctly exported and integrated into your application. If issues persist, verify compatibility with the latest version of the package. For more details, check the Ultralytics documentation.

Thanks for you reply..but I'm trying with the project example that comes with the plugin...
I want to test that first, but the image classification doesn't work :(

@pderrenger
Copy link
Member

Please ensure the example project is up-to-date and correctly configured for TFLite. If the issue persists, try checking the model integration steps or consult the example's documentation for any specific requirements.

@sruizhuenei
Copy link

I ran the "flutter pub upgrade --major-versions" command to ensure that all are up to date.
I used the example models with cls in the name: metadata-cls.yaml and yolov8n_int8.tflite

...writting this response I realize that the example doesn't have a yolov8n-cls_int8.tflite and I was using the detection model trying to get classification images.

The detection work OK...

I need to review the classification model export task

@pderrenger
Copy link
Member

It sounds like you've identified the issue. Make sure to export the correct classification model using the appropriate export command. If you need further assistance, feel free to ask!

@sruizhuenei
Copy link

Not really 'cos I found that the example doesn't have a cls model for imageClassification, but I'm using my model trained for imageClassification and the metadata file for my model but I don't get any response neither.

Could you please help me with the example validating the classification feature.

Regards!

@pderrenger
Copy link
Member

Please ensure your model is correctly exported as a TFLite classification model and integrated into the example. If the issue persists, verify compatibility with the latest package version.

@sruizhuenei
Copy link

Thanks for the advice Paula.
I have my model working in the example app, but yesterday we review te results with the team and the image classification is wrong, i.e: if I see a bike with the camera, my model says that is a person with a 1.9% of accuracy. the accuracy is to low and obviously the detection is wrong. The same TFlite model in a PC with python works OK.

We will reviewing it a couple of days, but if you have this problem solved in some project please share the solution.

Regards!

@pderrenger
Copy link
Member

Thank you for sharing your experience. Please ensure your model is correctly optimized for mobile use. Differences in performance can occur due to hardware limitations. Double-check the preprocessing steps in your app to match those used during training. If the issue persists, consider retraining with more diverse data.

@sruizhuenei
Copy link

Well, the same model in the same app work different.
If I use the camera to inference the response are wrong
UltralyticsYoloCameraPreview( controller: controller, predictor: predictor, onCameraCreated: () { predictor.loadModel(useGpu: false); }, ),

If I use a picture from the gallery the inference is correct
void inference(String imagePath) { final imageClassifier = _initImageClassifierWithLocalModel(); imageClassifier.then((classifier) { classifier.loadModel(useGpu: false).then((_) { classifier.classify(imagePath: imagePath).then((results) { for (final object in results!) { print('${object?.label} - ' '${object?.confidence.toStringAsPrecision(2)}%'); } // print }); }); }); }

@pderrenger
Copy link
Member

@sruizhuenei it seems like there might be a difference in preprocessing between the camera and gallery inputs. Ensure both use the same preprocessing steps. If the issue persists, verify with the latest package version.

@sruizhuenei
Copy link

Hi, me again..I'd tryed to mimic the UltralyticsYoloCameraPreview() to enhance the live clasification, that is the error that I saw in this plugin, but I didn't have good results :(

Could you please upload a live camera classification example?
Or have you a channel to get a quick talk?

Regards!

@pderrenger
Copy link
Member

Hi, thanks for reaching out. We currently don't offer private support channels, but I recommend checking the latest updates in the repository for any new examples. If you have further questions, feel free to ask here!

@sruizhuenei
Copy link

yes, you recommend me that in all responses..
Thanks...

@pderrenger
Copy link
Member

You're welcome! If you have any other questions or need further assistance, feel free to ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants