Error trying to instantiate an encoder resnet50 or resnet101 #691
Unanswered
tiagoataquila
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I am having a strange problem.
model_101 = smp.Unet(
encoder_name="resnet34", # choose encoder, e.g. mobilenet_v2 or efficientnet-b7
encoder_weights="imagenet", # use
imagenet
pre-trained weights for encoder initializationin_channels=3, # model input channels (1 for gray-scale images, 3 for RGB, etc.)
classes=3, # model output channels (number of classes in your dataset)
).to(device)
This code works perfectly fine..
but if I use resnet50 or 101 for the encoder_name I get a very strange error
`71 self.encoder = get_encoder(
72 encoder_name,
73 in_channels=in_channels,
~/workdir/notebooks/notebookenv/lib/python3.8/site-packages/segmentation_models_pytorch/encoders/init.py in get_encoder(name, in_channels, depth, weights, output_stride, **kwargs)
81 )
82 )
---> 83 encoder.load_state_dict(model_zoo.load_url(settings["url"]))
84
85 encoder.set_in_channels(in_channels, pretrained=weights is not None)
~/workdir/notebooks/notebookenv/lib/python3.8/site-packages/torch/hub.py in load_state_dict_from_url(url, model_dir, map_location, progress, check_hash, file_name)
551 r = HASH_REGEX.search(filename) # r is Optional[Match[str]]
552 hash_prefix = r.group(1) if r else None
--> 553 download_url_to_file(url, cached_file, hash_prefix, progress=progress)
554
555 if _is_legacy_zip_format(cached_file):
~/workdir/notebooks/notebookenv/lib/python3.8/site-packages/torch/hub.py in download_url_to_file(url, dst, hash_prefix, progress)
436 if hash_prefix is not None:
437 sha256 = hashlib.sha256()
--> 438 with tqdm(total=file_size, disable=not progress,
439 unit='B', unit_scale=True, unit_divisor=1024) as pbar:
440 while True:
~/workdir/notebooks/notebookenv/lib/python3.8/site-packages/tqdm/notebook.py in init(self, *args, **kwargs)
240 unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1
241 total = self.total * unit_scale if self.total else self.total
--> 242 self.container = self.status_printer(self.fp, total, self.desc, self.ncols)
243 self.container.pbar = proxy(self)
244 self.displayed = False
~/workdir/notebooks/notebookenv/lib/python3.8/site-packages/tqdm/notebook.py in status_printer(_, total, desc, ncols)
113 # Prepare IPython progress bar
114 if IProgress is None: # #187 #451 #558 #872
--> 115 raise ImportError(
116 "IProgress not found. Please update jupyter and ipywidgets."
117 " See https://ipywidgets.readthedocs.io/en/stable"
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html`
Why would loading a specific encoder demand me to have Tqdm widgets installed? For me this makes no sense! Can anyone shed some light in this for me?
Beta Was this translation helpful? Give feedback.
All reactions