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

Large models are not supported yet #14

Open
godisme1220 opened this issue Jun 4, 2024 · 1 comment
Open

Large models are not supported yet #14

godisme1220 opened this issue Jun 4, 2024 · 1 comment

Comments

@godisme1220
Copy link

`---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In[15], line 2
1 # Generates a directory with masks
----> 2 segmenter = GlassesSegmenter(kind="lenses", size="l")
3 segmenter.process_dir(
4 input_path=r"C:/python_project/glasses-detector/data", # output dir defaults to path/to/dir_preds
5 output_path="./output",
(...)
10 output_size=None, # set to None to keep the same size as image
11 )

File :7, in init(self, kind, size, weights, device)

File c:\Users\EugeneLin\AppData\Local\miniconda3\envs\GLASSES-DETECTOR\Lib\site-packages\glasses_detector\components\base_model.py:189, in BaseGlassesModel.post_init(self)
185 self.device = torch.device("cpu")
187 if self.weights:
188 # Load weights if True or path is specified
--> 189 self.load_weights(path_or_url=self.weights)
191 # Cast to device
192 self.model.to(self.device)

File c:\Users\EugeneLin\AppData\Local\miniconda3\envs\GLASSES-DETECTOR\Lib\site-packages\glasses_detector\components\base_model.py:547, in BaseGlassesModel.load_weights(self, path_or_url)
544 return
546 if self.size.lower() in self.ALLOWED_SIZE_ALIASES["large"]:
--> 547 raise NotImplementedError("Large models are not supported yet")
549 # Construct weights URL from base URL and model info
550 weights_name = f"{self.task}{self.kind}{name}.pth"

NotImplementedError: Large models are not supported yet
`

Dear glasses-detector developer, thanks for this amazing tool, helping me a lot! While I'm using segmenter, I input size argument with "large" or "l". In the API document page, it does support the large argument, but when I input the large argument, it returns upper error, how can I fix it?

image

Thanks for reply, Eugene Lin.

@mantasu
Copy link
Owner

mantasu commented Jun 4, 2024

Hi @godisme1220, yeah, unfortunately, weights for large models are unavailable but it is only indicated in Performance Section. Thanks for pointing this out, I should make documentation clearer. It is only possible to instantiate a large model without pretrained weights:

segmenter = GlassesSegmenter(size="large", weights=False)

If you specifically need lenses segmentation, then you could check #13 where I provided large model weights that may work slightly better.

In general, I tried training large models for all tasks but their performance did not outperform medium models, thus I didn't include them. I think these could be the reasons:

  • Large models are typically used for more complex tasks, here we are dealing with binary segmentation/classification
  • Large models would perform better if they were trained on much larger datasets (I couldn't find more :/)
  • Large models could perform better if the model architecture, as well as hyperparameters, were specifically tuned for each task

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