run the script:
!CUDA_VISIBLE_DEVICES=0 PYTHONPATH=
pwd python lxmert/lxmert/perturbation.py --COCO_path val2014 --method transformer_att --is-text-pert false --is-positive-pert true
the error:
`loading configuration file cache
loading weights file https://cdn.huggingface.co/unc-nlp/frcnn-vg-finetuned/pytorch_model.bin from cache at /root/.cache/torch/transformers/57f6df6abe353be2773f2700159c65615babf39ab5b48114d2b49267672ae10f.77b59256a4cf8343ae0f923246a81489fc8d82f98d082edc2d2037c977c0d9d0
All model checkpoint weights were used when initializing GeneralizedRCNN.
All the weights of GeneralizedRCNN were initialized from the model checkpoint at unc-nlp/frcnn-vg-finetuned.
If your task is similar to the task the model of the checkpoint was trained on, you can already use GeneralizedRCNN for predictions without further training.
/usr/local/lib/python3.7/dist-packages/torch/nn/modules/container.py:435: UserWarning: Setting attributes on ParameterList is not supported.
warnings.warn("Setting attributes on ParameterList is not supported.")
Load 214354 data from split(s) valid.
Load 214354 data from split(s) valid.
0% 0/10000 [00:00<?, ?it/s]runnig positive pert test for text modality with method transformer_att
0% 0/10000 [00:00<?, ?it/s]
Traceback (most recent call last):
File "lxmert/lxmert/perturbation.py", line 254, in
main(args)
File "lxmert/lxmert/perturbation.py", line 218, in main
R_t_t, R_t_i = baselines.generate_transformer_attr(item)
File "/content/drive/MyDrive/可解释性代码/Transformer-MM-Explainability-main/Transformer-MM-Explainability-main/lxmert/lxmert/src/ExplanationGenerator.py", line 375, in generate_transformer_attr
output = self.model_usage.forward(input).question_answering_score
File "lxmert/lxmert/perturbation.py", line 50, in forward
images, sizes, scales_yx = self.image_preprocess(image_file_path)
File "/content/drive/MyDrive/可解释性代码/Transformer-MM-Explainability-main/Transformer-MM-Explainability-main/lxmert/lxmert/src/processing_image.py", line 110, in call
torch.as_tensor(img_tensorize(images.pop(i), input_format=self.input_format))
File "/content/drive/MyDrive/可解释性代码/Transformer-MM-Explainability-main/Transformer-MM-Explainability-main/lxmert/lxmert/src/vqa_utils.py", line 550, in img_tensorize
img = get_image_from_url(im)
File "/content/drive/MyDrive/可解释性代码/Transformer-MM-Explainability-main/Transformer-MM-Explainability-main/lxmert/lxmert/src/vqa_utils.py", line 518, in get_image_from_url
response = requests.get(url)
File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 516, in request
prep = self.prepare_request(req)
File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 459, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/local/lib/python3.7/dist-packages/requests/models.py", line 314, in prepare
self.prepare_url(url, params)
File "/usr/local/lib/python3.7/dist-packages/requests/models.py", line 388, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'val2014COCO_val2014_000000092107.jpg': No schema supplied. Perhaps you meant http://val2014coco_val2014_000000092107.jpg/?`