Open godisme1220 opened 5 months ago
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:
`--------------------------------------------------------------------------- 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 weightsname = 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?
Thanks for reply, Eugene Lin.