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

about the python top level api #2

Open
yxdragon opened this issue Mar 5, 2019 · 1 comment
Open

about the python top level api #2

yxdragon opened this issue Mar 5, 2019 · 1 comment

Comments

@yxdragon
Copy link

yxdragon commented Mar 5, 2019

predict(path, framework, model)
I think it is beter to split it in two step, because new the predictor and predict is two step.

  1. modelo = predictor_factory.getPredictor(framework, model), in this step, the h5file, and json file should be downloaded, not when predict. That means everything is ok, I can work anytime.
  2. predict( ndarray ), ndarray is the standard format in python image processing.

if you mix these in one method, when predict multi times, the model would be built again and again, (just my guess, right?), And the most important is, It is not friendly for user when predict first time, I did not known it is downloading file, but I think why it predicts so slow!

could you modify like this? then I will give a pr to imagepy plugin, which split build model and predict. And add the batch supporting in predict, then generate and show a result list.

@adines
Copy link
Owner

adines commented May 2, 2019

Hi @yxdragon,
the process of predicting and loading the model is separated. When you classify an image, the model is first loaded and the weights are downloaded, in case they are not already downloaded; using the ModelFactory. Once the model is loaded, we use the predict method to classify the image.

For this reason, when a user predict multi times, the model is only loaded the first time and then the model is used several times. The first time you predict with a new model it have to be downloaded (I will add a message or a progress bar indicating that) and that makes the process so slow.

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

2 participants