question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Ensemble model.

See original GitHub issue

When I want to use Ensemble model, like the tutorial"

resp_obj = DeepFace.verify("img1.jpg", "img2.jpg", model_name = "Ensemble")

I get the following error: There is an error with this image and modelCould not open /usr/local/lib/python3.6/dist-packages/deepface/models/face-recognition-ensemble-model.txt

How we can solve that?

the library version is 0.0.31

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
serengilcommented, Jul 1, 2020

PS: do not forget to star the repo please 😃

1reaction
serengilcommented, Jul 1, 2020

Let me explain the problem, maybe this helps some people having same trouble

Firstly, ensemble model needs .txt file and I stored in the repo: https://github.com/serengil/deepface/tree/master/deepface/models

Even though this text file exists in the repo, this won’t be uploaded to PyPI. Before 0.0.32, this does not exist in the repo.

Then, I found that if you add this text file as script in setup.py, then this will be uploaded to pypi.

scripts=['deepface/models/face-recognition-ensemble-model.txt'],

Even though this is uploaded to pypi, this won’t be copied when you call pip install command. That’s why, I downloaded this text file externally in the code.

DeepFace.py

home = str(Path.home())
				
if os.path.isfile(home+'/.deepface/weights/face-recognition-ensemble-model.txt') != True:
	print("face-recognition-ensemble-model.txt will be downloaded...")
	url = 'https://raw.githubusercontent.com/serengil/deepface/master/deepface/models/face-recognition-ensemble-model.txt'
	output = home+'/.deepface/weights/face-recognition-ensemble-model.txt'
	gdown.download(url, output, quiet=False)

ensemble_model_path = home+'/.deepface/weights/face-recognition-ensemble-model.txt'

deepface_ensemble = lgb.Booster(model_file = ensemble_model_path)

Funnily, this text file will be downloaded from GitHub repo 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

When You Shouldn't Use Ensemble Learning - Deepchecks
Ensemble methods can be useful in reducing variance and making more robust models, however, there are plenty of downsides to using such as...
Read more >
Some Fundamental Issues in Ensemble Methods
The factors studied include the accuracy of individual models, the diversity among the individual models in an ensemble, decision-making strategy, and the ...
Read more >
Ensemble Models: What Are They and When Should You Use ...
Sometimes one model isn't enough. In this guide to ensemble models, I'll walk you through how (and when) to use ensemble techniques for...
Read more >
Ensemble Modeling - an overview | ScienceDirect Topics
The ensemble model then aggregates the prediction of each base model and results in once final prediction for the unseen data. The motivation...
Read more >
Some fundamental issues in ensemble methods - IEEE Xplore
The factors studied include the accuracy of individual models, the diversity among the individual models in an ensemble, decision-making strategy, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found