silviazuffi / smalst

MIT License
163 stars 24 forks source link

AttributeError: 'module' object has no attribute 'cos_sim' #15

Closed MayuOshima closed 4 years ago

MayuOshima commented 4 years ago

Hello, when I run the training code, the following error come out. Could you please give me some advice about how to correct this error? Thank you!

Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 624, in app.run(main) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 274, in run _run_main(main, argv) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 238, in _run_main sys.exit(main(argv)) File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 621, in main trainer.train() File "nnutils/train_utils.py", line 255, in train self.forward() File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 452, in forward self.tex_loss = self.texture_loss(self.texture_pred, self.imgs, self.mask_pred, self.masks[:,0,:,:]) File "nnutils/loss_utils.py", line 244, in call dist = self.perceptual_loss(img_pred mask_gt, img_gt mask_gt) File "nnutils/perceptual_loss.py", line 34, in call dist = self.model.forward_pair(target, pred) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/dist_model.py", line 101, in forward_pair return self.net.forward(in1,in2) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/networks_basic.py", line 55, in forward cur_score = (1.-util.cos_sim(outs0[kk],outs1[kk])) AttributeError: 'module' object has no attribute 'cos_sim'

silviazuffi commented 4 years ago

Hi, That is external code, but I think you should check if this include works properly from ..util import util as util

On 30. Nov 2020, at 16:02, Nagisa Kaworu notifications@github.com wrote:

Hello, when I run the training code, the following error come out. Could you please give me some advice about how to correct this error? Thank you!

Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 624, in app.run(main) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 274, in run _run_main(main, argv) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 238, in _run_main sys.exit(main(argv)) File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 621, in main trainer.train() File "nnutils/train_utils.py", line 255, in train self.forward() File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 452, in forward self.tex_loss = self.texture_loss(self.texture_pred, self.imgs, self.mask_pred, self.masks[:,0,:,:]) File "nnutils/loss_utils.py", line 244, in call dist = self.perceptual_loss(img_pred mask_gt, img_gt mask_gt) File "nnutils/perceptual_loss.py", line 34, in call dist = self.model.forward_pair(target, pred) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/dist_model.py", line 101, in forward_pair return self.net.forward(in1,in2) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/networks_basic.py", line 55, in forward cur_score = (1.-util.cos_sim(outs0[kk],outs1[kk])) AttributeError: 'module' object has no attribute 'cos_sim'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/silviazuffi/smalst/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFIJ7EIMVNYPMHPPP33SSOXZFANCNFSM4UHWA7EA.

MayuOshima commented 4 years ago

Hi, That is external code, but I think you should check if this include works properly from ..util import util as util On 30. Nov 2020, at 16:02, Nagisa Kaworu @.**> wrote: Hello, when I run the training code, the following error come out. Could you please give me some advice about how to correct this error? Thank you! Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 624, in app.run(main) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 274, in run _run_main(main, argv) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 238, in _run_main sys.exit(main(argv)) File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 621, in main trainer.train() File "nnutils/train_utils.py", line 255, in train self.forward() File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 452, in forward self.tex_loss = self.texture_loss(self.texture_pred, self.imgs, self.mask_pred, self.masks[:,0,:,:]) File "nnutils/loss_utils.py", line 244, in call dist = self.perceptual_loss(img_pred mask_gt, img_gt * mask_gt) File "nnutils/perceptual_loss.py", line 34, in call dist = self.model.forward_pair(target, pred) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/dist_model.py", line 101, in forward_pair return self.net.forward(in1,in2) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/networks_basic.py", line 55, in forward cur_score = (1.-util.cos_sim(outs0[kk],outs1[kk])) AttributeError: 'module' object has no attribute 'cos_sim' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#15>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFIJ7EIMVNYPMHPPP33SSOXZFANCNFSM4UHWA7EA.

Thank you! Just now I have made this work and it seems the training process is going on well. So can I ask another question? How can I view the loss curve? Is there something like tensorboard been used?(I am sorry I couldn't find something about this in the code)

silviazuffi commented 4 years ago

I am glad it works. The code just prints the smoothed loss.

On 30. Nov 2020, at 16:29, Nagisa Kaworu notifications@github.com wrote:

Hi, That is external code, but I think you should check if this include works properly from ..util import util as util … <x-msg://67/#> On 30. Nov 2020, at 16:02, Nagisa Kaworu @.**> wrote: Hello, when I run the training code, the following error come out. Could you please give me some advice about how to correct this error? Thank you! Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 624, in app.run(main) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 274, in run _run_main(main, argv) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 238, in _run_main sys.exit(main(argv)) File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 621, in main trainer.train() File "nnutils/train_utils.py", line 255, in train self.forward() File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 452, in forward self.tex_loss = self.texture_loss(self.texture_pred, self.imgs, self.mask_pred, self.masks[:,0,:,:]) File "nnutils/loss_utils.py", line 244, in call dist = self.perceptual_loss(img_pred mask_gt, img_gt * mask_gt) File "nnutils/perceptual_loss.py", line 34, in call dist = self.model.forward_pair(target, pred) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/dist_model.py", line 101, in forward_pair return self.net.forward(in1,in2) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/networks_basic.py", line 55, in forward cur_score = (1.-util.cos_sim(outs0[kk],outs1[kk])) AttributeError: 'module' object has no attribute 'cos_sim' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#15 https://github.com/silviazuffi/smalst/issues/15>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFIJ7EIMVNYPMHPPP33SSOXZFANCNFSM4UHWA7EA https://github.com/notifications/unsubscribe-auth/ABNYVFIJ7EIMVNYPMHPPP33SSOXZFANCNFSM4UHWA7EA.

Thank you! Just now I have made this work and it seems the training process is going on well. So can I ask another question? How can I view the loss curve? Is there something like tensorboard been used?(I am sorry I couldn't find something about this in the code)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/silviazuffi/smalst/issues/15#issuecomment-735856694, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFOGU3C3Z7A3YDL2JGLSSO26HANCNFSM4UHWA7EA.

MayuOshima commented 4 years ago

I am glad it works. The code just prints the smoothed loss. On 30. Nov 2020, at 16:29, Nagisa Kaworu @.> wrote: Hi, That is external code, but I think you should check if this include works properly from ..util import util as util … <x-msg://67/#> On 30. Nov 2020, at 16:02, Nagisa Kaworu @.> wrote: Hello, when I run the training code, the following error come out. Could you please give me some advice about how to correct this error? Thank you! Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 624, in app.run(main) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 274, in run _run_main(main, argv) File "/Disk1/siqi/smalst/venv_smalst/lib/python2.7/site-packages/absl/app.py", line 238, in _run_main sys.exit(main(argv)) File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 621, in main trainer.train() File "nnutils/train_utils.py", line 255, in train self.forward() File "/Disk1/siqi/smalst/experiments/smal_shape.py", line 452, in forward self.tex_loss = self.texture_loss(self.texture_pred, self.imgs, self.mask_pred, self.masks[:,0,:,:]) File "nnutils/loss_utils.py", line 244, in call dist = self.perceptual_loss(img_pred mask_gt, img_gt mask_gt) File "nnutils/perceptual_loss.py", line 34, in call dist = self.model.forward_pair(target, pred) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/dist_model.py", line 101, in forward_pair return self.net.forward(in1,in2) File "/Disk1/siqi/smalst/external/PerceptualSimilarity/models/networks_basic.py", line 55, in forward cur_score = (1.-util.cos_sim(outs0[kk],outs1[kk])) AttributeError: 'module' object has no attribute 'cos_sim' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#15 <#15>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFIJ7EIMVNYPMHPPP33SSOXZFANCNFSM4UHWA7EA https://github.com/notifications/unsubscribe-auth/ABNYVFIJ7EIMVNYPMHPPP33SSOXZFANCNFSM4UHWA7EA. Thank you! Just now I have made this work and it seems the training process is going on well. So can I ask another question? How can I view the loss curve? Is there something like tensorboard been used?(I am sorry I couldn't find something about this in the code) — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#15 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNYVFOGU3C3Z7A3YDL2JGLSSO26HANCNFSM4UHWA7EA.

OK. Thanks for your reply!