Closed ale-trevizoli closed 4 months ago
Hey, currently only the package installable from pip
works, i.e., the latest v0.1.1 release (if you consider cloning, please clone the release). It does not have a model for the eyeglasses classifier, but you can manually download the weights. Check this issue on how to set up the classifier.
In short:
eyeglasses_classifier_shufflenet_v2_x0_5.pth
inside C:\Users\<Your Username>\.cache\torch\hub\checkpoints
--size small
If you experience further errors, let me know~
The current source code is heavily under development and will have a much better user interface and more features and it should be finished by the end of February (depending on when the models finish training). So please do not clone the repository directly.
thanks - your suggestion worked!
is possible to define different folder to put model?
In this version, it may be a bit tricky as you would need to create a python script and manually load the weights from a custom location when instantiating the model. However, you could also simply change torch hub path, e.g., on windows:
setx TORCH_HOME "C:\torch_models"
Then just place eyeglasses_classifier_shufflenet_v2_x0_5.pth
inside C:\torch_models\hub\checkpoints
Hi! I'm trying to use, I tried first to clone this source code, but I'm using Py 3.11 and I receive a lot of errors, so now I'm using pip install glasses-detector (compiled package).
but I'm not haven error codes that I had when I use src code, but I think it's not finding something that need to download.
Thanks! I'm searching for an glasses detector for long time, hope to can use this.
glasses-detector -i .\fotos\foto_alexandre.jpg --kind anyglasses-classifier Downloading: "https://github.com/mantasu/glasses-detector/releases/download/eyeglasses_classifier_shufflenet_v2_x0_5.pth" to C:\Users\Alexandre/.cache\torch\hub\checkpoints\eyeglasses_classifier_shufflenet_v2_x0_5.pth Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Program Files\Python311\Scripts\glasses-detector.exe__main.py", line 7, in
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector__main.py", line 175, in main
model = model_cls(base_model=base_model, pretrained=True).to(device).eval()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector\classifiers.py", line 195, in init__
self.eyeg_classifier = EyeglassesClassifier(base_model[0], pretrained[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector\classifiers.py", line 73, in init
super().init__(base_model, pretrained)
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector\bases\base_classifier.py", line 72, in init
super().init(*args, *kwargs)
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector\bases\base_model.py", line 134, in init
self._init_from_base_model(base_model, pretrained)
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector\bases\base_model.py", line 265, in _init_from_base_model
self._load_weights_from_url(self.kind, self.name, version)
File "C:\Program Files\Python311\Lib\site-packages\glasses_detector\bases\base_model.py", line 280, in _load_weights_from_url
weights = torch.hub.load_state_dict_from_url(url, map_location=device)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\site-packages\torch\hub.py", line 766, in load_state_dict_from_url
download_url_to_file(url, cached_file, hash_prefix, progress=progress)
File "C:\Program Files\Python311\Lib\site-packages\torch\hub.py", line 620, in download_url_to_file
u = urlopen(req)
^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\urllib\request.py", line 525, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\urllib\request.py", line 634, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\urllib\request.py", line 563, in error
return self._call_chain(args)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\urllib\request.py", line 643, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found