Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

predict.py error #1

Open
nnevatie opened this issue Jun 23, 2022 · 16 comments
Open

predict.py error #1

nnevatie opened this issue Jun 23, 2022 · 16 comments
Labels
enhancement New feature or request

Comments

@nnevatie
Copy link

Running predict.py leads to an error:

python predict.py
Traceback (most recent call last):
  File "predict.py", line 13, in <module>
    from untitled1 import Generator
ModuleNotFoundError: No module named 'untitled1'
@zhangbaijin
Copy link
Owner

I have changed it. So you can try again. Best wishes

@chenkaixin66
Copy link

Running predict.py leads to an error:
File "predict1.py", line 57, in predict
allim[0, 2, :] = heat_att
IndexError: index 2 is out of bounds for axis 1 with size 1

@zhangbaijin
Copy link
Owner

你可以把报错多放点上来,代码应该是没有问题的,是不是索引测试数据集的问题,都要resize成640X480,具体批量resize可以看我代码里的bigresize.py

@chenkaixin66
Copy link

已经把图像resize成了640*480 在predict.py文件中
allim[0, 0, :] = in_rgb * 255
allim[0, 0, :] = out_rgb * 255
allim[0, 2, :] = heat_att
allim的shape是[1,1,3,480,640],对于最后一行的2,超出了索引。具体错误如下:
(cq) [chenqing@8p100 ~/cq1/SpA-Former-shadow-removal-main]$ python predict1.py --config ./config.yml --test_dir ./data/predict/ --out_dir ./out --pretrained ./results/000001/models/gen_model_epoch_160.pth --cuda
Random Seed: 0
===> Loading models
0%| | 0/1 [00:01<?, ?it/s]
Traceback (most recent call last):
File "predict1.py", line 83, in
predict(config, args)
File "predict1.py", line 57, in predict
allim[0, 2, :] = heat_att
IndexError: index 2 is out of bounds for axis 1 with size 1

@zhangbaijin
Copy link
Owner

你的预训练模型放的路径位置对吗,不用跟我一模一样

@zhangbaijin
Copy link
Owner

如果报错的话,你可以把allim[0, 2, :] = heat_att这边注释,这个是注意力热图,注释了还是可以输出预测图的

@chenkaixin66
Copy link

您好 这个predict.py的测速集是必须和训练集一样有test-A test-B test-C三个数据集吗?我是想做一个推理,输进去一个图片,输出去阴影之后的图片,这个是用哪个py文件啊

@zhangbaijin
Copy link
Owner

不是的,只需要test-A一个就行了,里面是带有阴影的图片,就运行predict.py就行,路径填对,应该没问题

@chenkaixin66
Copy link

不是的,只需要test-A一个就行了,里面是带有阴影的图片,就运行predict.py就行,路径填对,应该没问题

现在可以运行成功,但是好像没有效果啊,得到的结果还是有阴影。python predict.py --config ./config.yml --test_dir ./data/predict/ --out_dir ./out --pretrained ./results/000001/models/gen_model_epoch_160.pth --cuda 这些路经都没有问题

@zhangbaijin
Copy link
Owner

把图放上来看看呢

@zhangbaijin
Copy link
Owner

我建议你可以把图resize成256x256

Repository owner deleted a comment from chenkaixin66 Jul 20, 2022
@chenkaixin66
Copy link

我建议你可以把图resize成256x256

刚刚尝试了把图片resize成256之后还是不行。感觉得到的结果和原始图像没有区别。这是为什么啊?下面是模型的进程,应该是没错误的吧
(cq) [chenqing@8p100 ~/cq1/SpA-Former-shadow-removal-main]$ python predict1.py --config ./config.yml --test_dir ./data/predict/ --out_dir ./out --pretrained ./results/000001/models/gen_model_epoch_160.pth --cuda
Random Seed: 0
===> Loading models
100%|█████████████████████████████████████████████████████████████████████████| 7/7 [00:01<00:00, 3.68it/s]

@zhangbaijin
Copy link
Owner

image
image

蛮奇怪的,我在上传我的可视化结果到谷歌云,有可能跟显卡有关,我用的是3090,但是不至于说一点都推断不出来

@chenkaixin66
Copy link

image image

蛮奇怪的,我在上传我的可视化结果到谷歌云,有可能跟显卡有关,我用的是3090,但是不至于说一点都推断不出来

我设置的输出路径是out/ , 实际得到推断的路径是out/epoch_0001/ 这是合理的吗?

@zhangbaijin
Copy link
Owner

合理的

@zhangbaijin zhangbaijin added the enhancement New feature or request label Jul 25, 2022
@ShunTatsukawa
Copy link

I have changed it. So you can try again. Best wishes

I am having the same untitled1 problem, where can I update to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants