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

Can you please add opportunity to use "MobileNet" model with more labels #16

Closed
dsrenesanse opened this issue Mar 11, 2019 · 6 comments
Closed

Comments

@dsrenesanse
Copy link

dsrenesanse commented Mar 11, 2019

byte[] binary = (byte[])args.get("binary");
String model = args.get("model").toString();
double threshold = (double)args.get("threshold");
float THRESHOLD = (float)threshold;
List ANCHORS = (ArrayList)args.get("anchors");
int BLOCK_SIZE = (int)args.get("blockSize");
int NUM_BOXES_PER_BLOCK = (int)args.get("numBoxesPerBlock");
int NUM_RESULTS_PER_CLASS = (int)args.get("numResultsPerClass");

ByteBuffer imgData = ByteBuffer.wrap(binary);

if (model.equals("SSDMobileNet")) {
  return parseSSDMobileNet(imgData, NUM_RESULTS_PER_CLASS, THRESHOLD);
} else {
  return parseYOLO(imgData, BLOCK_SIZE, NUM_BOXES_PER_BLOCK, ANCHORS, THRESHOLD, NUM_RESULTS_PER_CLASS);
}
}

sorry, no link, old browser

@dsrenesanse dsrenesanse changed the title Can you please add opportunity to use "MobileNet" model with more labels, pls Can you please add opportunity to use "MobileNet" model with more labels Mar 11, 2019
@shaqian
Copy link
Owner

shaqian commented Mar 13, 2019

Hi Daniel,

What do you mean by using more labels? The library reads labels from the asset file you assigned to loadModel() method.

Thanks,
Qian

@dsrenesanse
Copy link
Author

Well, I tried to use just a MobileNet model and found a problem, wrong dimensions compared with the java array. To see a problem, try to load "MobileNet" model with txt which follows

@westracer
Copy link

@Renesanse Do you mean another number of detections? Because when I tried to use retrained model I got error like [1,10,4] isn't [1,16,4]. After changing that const, everything went well, though I have different labels.

@dsrenesanse
Copy link
Author

dsrenesanse commented Mar 20, 2019

Not a number of detections, I would like to use different tf model from example with 1000 names.

@shaqian
Copy link
Owner

shaqian commented Mar 20, 2019

MobileNet is image classification model. Instead of detectObjectOnImage method, please use runModelOnImage.
https://github.com/shaqian/flutter_tflite#image-classification

@dsrenesanse
Copy link
Author

ok, thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants