Comments (5)
@HoangBee102 this error indicates a shape mismatch between the TensorFlowLite tensor and the Java object. To resolve this, ensure that the output format of the model matches the input requirements of your application. You might need to reshape or transpose the tensor accordingly. Check the model's output configuration and the input expectations of your Java object for compatibility.
If you need further assistance, consider sharing additional details about your inference pipeline, including the model configuration and relevant code snippets.
For comprehensive information on YOLOv5 usage, refer to the Ultralytics Docs at https://docs.ultralytics.com/yolov5/.
from yolov5.
`public void setInput(Bitmap resizedbitmap){
boolean quantized_mode = TfliteRunMode.isQuantizedMode(this.runmode);
int numBytesPerChannel = quantized_mode ? numBytesPerChannel_int : numBytesPerChannel_float;
ByteBuffer imgData = ByteBuffer.allocateDirect(1 * inputSize * inputSize * 3 * numBytesPerChannel);
int[] intValues = new int[inputSize * inputSize];
resizedbitmap.getPixels(intValues, 0, resizedbitmap.getWidth(), 0, 0, resizedbitmap.getWidth(), resizedbitmap.getHeight());
imgData.order(ByteOrder.nativeOrder());
imgData.rewind();
for (int i = 0; i < inputSize; ++i) {
for (int j = 0; j < inputSize; ++j) {
int pixelValue = intValues[i * inputSize + j];
if (quantized_mode) {
// Quantized model
imgData.put((byte) ((pixelValue >> 16) & 0xFF));
imgData.put((byte) ((pixelValue >> 8) & 0xFF));
imgData.put((byte) (pixelValue & 0xFF));
} else { // Float model
float r = (((pixelValue >> 16) & 0xFF)) / 255.0f;
float g = (((pixelValue >> 8) & 0xFF)) / 255.0f;
float b = ((pixelValue & 0xFF)) / 255.0f;
imgData.putFloat(r);
imgData.putFloat(g);
imgData.putFloat(b);
}
}
}
this.inputArray = new Object[]{imgData};
this.outputMap = new HashMap<>();
outputMap.put(0, this.rawres.out1);
outputMap.put(1, this.rawres.out2);
outputMap.put(2, this.rawres.out3);
}`
My custom train has 2 class, model export from ultralytic hub .tflite
Model in netron app:
Author say me:
I think you don't follow this instruction. https://github.com/lp6m/yolov5s_android/tree/master/convert_model#onnx---openvino
Pls help me howto fix???
from yolov5.
@HoangBee102 i see that you're trying to use a custom YOLOv5 model in a demo app, and it seems you are facing some issues related to the model input and output configurations. It's important to ensure that the input preprocessing in your custom code matches the input requirements of the model and the post-processing matches the model's output format.
It looks like there might be a discrepancy between the input processing in your code and the model's expected input format.
Regarding the author's suggestion, it would be helpful to review the instruction link provided and confirm if the conversion steps have been followed accurately.
For comprehensive guidance on using custom YOLOv5 models, including input preprocessing and output post-processing, I recommend referring to the Ultralytics Docs at https://docs.ultralytics.com/yolov5/.
Feel free to provide additional details or code snippets if you need further assistance.
from yolov5.
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
- Docs: https://docs.ultralytics.com
- HUB: https://hub.ultralytics.com
- Community: https://community.ultralytics.com
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
from yolov5.
@HoangBee102 did you sloved the problem?
from yolov5.
Related Issues (20)
- Continuous training of a Ultralytics Model HOT 4
- Exporting trained yolov5 model (trained on custom dataset) to 'saved model' format changes the no. of classes and the name of classes to default coco128 values HOT 2
- more details about training procedure HOT 4
- divide the objects into small and large categories based on the size of the bonding boxes HOT 8
- Request for YOLOv5 v6.2 Source Code under GPL-3.0 License HOT 4
- What prevents me from using the AMP function? HOT 4
- What prevents me from using the AMP function? HOT 1
- What prevents me from using the AMP function? HOT 1
- Background annotation HOT 6
- Hi @7rkMnpl, HOT 2
- Multiple GPU Hyperparameter evolution HOT 5
- Marking YOLOv5 Detection Text Outputs with TP or FP HOT 4
- Multiple threads using yolov5 model concurrent inference failed HOT 4
- Detect head structure differs HOT 4
- runs\train\exp10 is not a directory HOT 12
- Similar mAP when splitting data into train, val and test HOT 4
- Syntax and understanding questions about reading tensorflow lite results HOT 1
- A Error which blast my mind.... HOT 1
- Yolov5 Int8 export in PyTorch HOT 10
- Video inference with YOLOv5 model in python HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yolov5.