patchcore-few-shot icon indicating copy to clipboard operation
patchcore-few-shot copied to clipboard

Issue when running sample code.

Open couragelfyang opened this issue 5 months ago • 0 comments

I encountered issues when running run_shot_study_mvtec_coreset_augmentations.sh. Any suggestion?

k-shot: 1
run: 0
category: bottle



Loading model antialiased_wide_resnet50_2 from antialias_cnn
Traceback (most recent call last):
  File "scripts/few_shot_training.py", line 304, in <module>
    train()
  File "scripts/few_shot_training.py", line 284, in train
    train_step(
  File "scripts/few_shot_training.py", line 91, in train_step
    model = get_model(config)
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/__init__.py", line 65, in get_model
    model = getattr(module, f"{_snake_to_pascal_case(config.model.name)}Lightning")(config)
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/patchcore/lightning_model.py", line 131, in __init__
    super().__init__(
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/patchcore/lightning_model.py", line 49, in __init__
    self.model: PatchcoreModel = PatchcoreModel(
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/patchcore/torch_model.py", line 62, in __init__
    model = antialiased_cnns.wide_resnet50_2(pretrained=True)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/site-packages/antialiased_cnns/resnet.py", line 406, in wide_resnet50_2
    model.load_state_dict(model_zoo.load_url(model_urls['wide_resnet50_2_lpf4_finetune'], map_location='cpu', check_hash=True)['state_dict'])
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/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 "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/site-packages/torch/hub.py", line 620, in download_url_to_file
    u = urlopen(req)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/config/config.py:304: UserWarning: The seed value is now fixed to 0. Up to v0.3.7, the seed was not fixed when the seed value was set to 0. If you want to use the random seed, please select `None` for the seed value (`null` in the YAML file) or remove the `seed` key from the YAML file.
  warn(
Global seed set to 0
2024-01-17 01:48:34,202 - anomalib - INFO - Doing category: bottle
2024-01-17 01:48:34,203 - anomalib.data - INFO - Loading the datamodule
2024-01-17 01:48:34,203 - anomalib.data.utils.transform - INFO - No config file has been provided. Using default transforms.
2024-01-17 01:48:34,203 - anomalib.data.utils.transform - INFO - No config file has been provided. Using default transforms.
2024-01-17 01:48:34,203 - anomalib.data.mvtec - INFO - Found the dataset.
2024-01-17 01:48:34,253 - anomalib - INFO - Training on 1 examples
2024-01-17 01:48:34,253 - anomalib - INFO -                     path  split  ... label_index mask_path
0  datasets/mvtec/bottle  train  ...           0

[1 rows x 6 columns]
2024-01-17 01:48:34,259 - anomalib.models - INFO - Loading the model.
2024-01-17 01:48:34,260 - anomalib.models.components.base.anomaly_module - INFO - Initializing PatchcoreLightning model.
/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/site-packages/torchmetrics/utilities/prints.py:36: UserWarning: Metric `PrecisionRecallCurve` will save all targets and predictions in buffer. For large datasets this may lead to large memory footprint.
  warnings.warn(*args, **kwargs)
Downloading: "https://antialiased-cnns.s3.us-east-2.amazonaws.com/weights_v0.1/wide_resnet50_2_lpf4_finetune-02a183f7.pth" to /home/tslab/longfei/.cache/torch/hub/checkpoints/wide_resnet50_2_lpf4_finetune-02a183f7.pth
[16, 4, 4, 1, 1]
[None, None, None, None, None]



k-shot: 1
run: 0
category: bottle



Loading model antialiased_wide_resnet50_2 from antialias_cnn
Traceback (most recent call last):
  File "scripts/few_shot_training.py", line 304, in <module>
    train()
  File "scripts/few_shot_training.py", line 284, in train
    train_step(
  File "scripts/few_shot_training.py", line 91, in train_step
    model = get_model(config)
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/__init__.py", line 65, in get_model
    model = getattr(module, f"{_snake_to_pascal_case(config.model.name)}Lightning")(config)
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/patchcore/lightning_model.py", line 131, in __init__
    super().__init__(
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/patchcore/lightning_model.py", line 49, in __init__
    self.model: PatchcoreModel = PatchcoreModel(
  File "/net/papilio/storage5/nedo-otsl/longfei/patchcore-few-shot/src/anomalib/models/patchcore/torch_model.py", line 62, in __init__
    model = antialiased_cnns.wide_resnet50_2(pretrained=True)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/site-packages/antialiased_cnns/resnet.py", line 406, in wide_resnet50_2
    model.load_state_dict(model_zoo.load_url(model_urls['wide_resnet50_2_lpf4_finetune'], map_location='cpu', check_hash=True)['state_dict'])
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/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 "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/site-packages/torch/hub.py", line 620, in download_url_to_file
    u = urlopen(req)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/net/papilio/storage6/longfei/anaconda3/envs/nedo-fewshot/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

couragelfyang avatar Jan 17 '24 03:01 couragelfyang