Fighter20092392 / X-SDD-A-New-benchmark

Apache License 2.0
13 stars 5 forks source link

RepVGG model test process #2

Open huseyindervis19 opened 2 years ago

huseyindervis19 commented 2 years ago

Hello, after the repvgg algorithm creates the model, when I test the model using the test.py file, it gives the following error, can you tell me the reason?

Traceback (most recent call last): File "/content/X-SDD-A-New-benchmark/test.py", line 15, in model=torch.load('/content/gdrive/MyDrive/RepVGG16/repvgg_save.pth') File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1046, in _load result = unpickler.load() File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1039, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'RepVGG' on <module 'main' from '/content/X-SDD-A-New-benchmark/test.py'>

Fighter20092392 commented 2 years ago

Hello, you need to put the original model's code before the test code.

At 2022-05-17 16:43:02, "111programming111" @.***> wrote:

Hello, after the repvgg algorithm creates the model, when I test the model using the test.py file, it gives the following error, can you tell me the reason?

Traceback (most recent call last): File "/content/X-SDD-A-New-benchmark/test.py", line 15, in model=torch.load('/content/gdrive/MyDrive/RepVGG16/repvgg_save.pth') File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1046, in _load result = unpickler.load() File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1039, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'RepVGG' on <module 'main' from '/content/X-SDD-A-New-benchmark/test.py'>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

huseyindervis19 commented 2 years ago

Thank you, the repvgg model has been translated as 'repvgg deploy.pth' using the 'repvgg_model_convert' method, but now when we apply the test.py code, it gives this error

Traceback (most recent call last): File "/content/X-SDD-A-New-benchmark/test.py", line 45, in test() File "/content/X-SDD-A-New-benchmark/test.py", line 34, in test for imgs, path in tqdm(data_loader_test): File "/usr/local/lib/python3.7/dist-packages/tqdm/std.py", line 1195, in iter for obj in iterable: File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 530, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 570, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/X-SDD-A-New-benchmark/data/dataset.py", line 54, in getitem label = int(self.images[index].split('.')[-2].split('\')[-1]) ValueError: invalid literal for int() with base 10: '/content/gdrive/MyDrive/RepVGG16/data/test/img167'

Fighter20092392 commented 2 years ago

Hello!The label of the file in your dataset may not be the same as mine. You should change the piece of code “label = int(self.images[index].split('.')[-2].split('\')[-1])".

At 2022-05-17 22:56:23, "111programming111" @.***> wrote:

Thank you, the repvgg model has been translated as 'repvgg deploy.pth' using the 'repvgg_model_convert' method, but now when we apply the test.py code, it gives this error

Traceback (most recent call last): File "/content/X-SDD-A-New-benchmark/test.py", line 45, in test() File "/content/X-SDD-A-New-benchmark/test.py", line 34, in test for imgs, path in tqdm(data_loader_test): File "/usr/local/lib/python3.7/dist-packages/tqdm/std.py", line 1195, in iter for obj in iterable: File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 530, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 570, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/X-SDD-A-New-benchmark/data/dataset.py", line 54, in getitem label = int(self.images[index].split('.')[-2].split('\')[-1]) ValueError: invalid literal for int() with base 10: '/content/gdrive/MyDrive/RepVGG16/data/test/img167'

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

DoubleHui97 commented 2 years ago

您好,我把模型的权值训练好后,如何运行test文件啊?您提供的test文件在python中打开就会报错Unresolved reference 'Xception' 然后我在test文件前面输入from Xception_main import Xception,运行test是以下结果: D:\anaconda\python.exe "D:\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py" --path E:/liu_python_projects/X-SDD-A-New-benchmark-main/test2.py Testing started at 8:46 ... Launching pytest with arguments E:/liu_python_projects/X-SDD-A-New-benchmark-main/test2.py --no-header --no-summary -q in E:\liu_python_projects\X-SDD-A-New-benchmark-main

============================= test session starts ============================= collecting ... test2.py:None (test2.py) test2.py:18: in model = torch.load('E:\liu_python_projects\X-SDD-A-New-benchmark-main\logs\Xception\Xception_save.pth') D:\anaconda\lib\site-packages\torch\serialization.py:712: in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) D:\anaconda\lib\site-packages\torch\serialization.py:1046: in _load result = unpickler.load() D:\anaconda\lib\site-packages\torch\serialization.py:1039: in find_class return super().find_class(mod_name, name) E AttributeError: Can't get attribute 'Xception' on <module 'main' from 'D:\PyCharm Community Edition 2021.3.2\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py'> collected 0 items / 1 error

!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! ========================= 1 warning, 1 error in 1.65s =========================

进程已结束,退出代码2

DoubleHui97 commented 2 years ago

Hello, after the repvgg algorithm creates the model, when I test the model using the test.py file, it gives the following error, can you tell me the reason?

Traceback (most recent call last): File "/content/X-SDD-A-New-benchmark/test.py", line 15, in model=torch.load('/content/gdrive/MyDrive/RepVGG16/repvgg_save.pth') File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1046, in _load result = unpickler.load() File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1039, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'RepVGG' on <module 'main**' from '/content/X-SDD-A-New-benchmark/test.py'>

您解决这个test.py 运行问题了吗?Did you solve this test.py run problem?

Fighter20092392 commented 2 years ago

在我的anaconda上运行是没问题的,您可以仿照我的方式处理一下

--

网易VIP邮箱提醒:安全收发邮件,务必核实往来邮件地址、银行账号等机密信息,请通过电话或视频等多种方式确认信息真实性,提高警惕,请勿轻易透露个人重要信息。 Alert message of Netease Vipmail:Never provide your password, security questions, verification codes, or any other personal important information details to anyone else. You can identify mail message by telephone,video-chat or other ways.You should make sure that your email address, bank account and other confidential information as secure as possible. Thank you for keeping your email account secure.

At 2022-05-26 08:49:54, "Shuanghui Liu" @.***> wrote:

Hello, after the repvgg algorithm creates the model, when I test the model using the test.py file, it gives the following error, can you tell me the reason?

Traceback (most recent call last): File "/content/X-SDD-A-New-benchmark/test.py", line 15, in model=torch.load('/content/gdrive/MyDrive/RepVGG16/repvgg_save.pth') File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1046, in _load result = unpickler.load() File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 1039, in find_class return super().find_class(mod_name, name) AttributeError: Can't get attribute 'RepVGG' on <module 'main' from '/content/X-SDD-A-New-benchmark/test.py'>

您解决这个test.py 运行问题了吗?Did you solve this test.py run problem?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>