lihaoliu-cambridge / unsupervised-medical-image-segmentation

Code for "Contrastive Registration for Unsupervised Medical Image Segmentation".
63 stars 14 forks source link

AttributeError: 'RegistrationModel' object has no attribute 'loss_total' #3

Closed LimitedLi closed 3 years ago

LimitedLi commented 3 years ago

Thanks for your sharing. But I meet an error when I run the train.py as what is said in the README.md. I wonder how can I deal with it.

Traceback (most recent call last): File "F:\Lzy\unsupervised-medical-image-segmentation-master\unsupervised-medical-image-segmentation-master\models\base_model.py", line 63, in get_current_losses errorsret[name] = getattr(self, 'loss' + name).data.cpu().numpy() AttributeError: 'RegistrationModel' object has no attribute 'loss_total'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 71, in model.update_learning_rate(opt, float(model.get_current_losses()["total"])) File "F:\Lzy\unsupervised-medical-image-segmentation-master\unsupervised-medical-image-segmentation-master\models\base_model.py", line 65, in get_current_losses errorsret[name] = getattr(self, 'loss' + name) AttributeError: 'RegistrationModel' object has no attribute 'loss_total'

lihaoliu-cambridge commented 3 years ago

Thanks for your sharing. But I meet an error when I run the train.py as what is said in the README.md. I wonder how can I deal with it.

Traceback (most recent call last): File "F:\Lzy\unsupervised-medical-image-segmentation-master\unsupervised-medical-image-segmentation-master\models\base_model.py", line 63, in get_current_losses errorsret[name] = getattr(self, 'loss' + name).data.cpu().numpy() AttributeError: 'RegistrationModel' object has no attribute 'loss_total'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 71, in model.update_learning_rate(opt, float(model.get_current_losses()["total"])) File "F:\Lzy\unsupervised-medical-image-segmentation-master\unsupervised-medical-image-segmentation-master\models\base_model.py", line 65, in get_current_losses errorsret[name] = getattr(self, 'loss' + name) AttributeError: 'RegistrationModel' object has no attribute 'loss_total'

Hi. Thanks for using our code. This seems like a minor error. Could you please go to line 135 in ./models/registration_model_contrastive_learning.py and set a breakpoint (or simple print self.loss_total) to debug?

LimitedLi commented 3 years ago

Thanks for your sharing. But I meet an error when I run the train.py as what is said in the README.md. I wonder how can I deal with it. Traceback (most recent call last): File "F:\Lzy\unsupervised-medical-image-segmentation-master\unsupervised-medical-image-segmentation-master\models\base_model.py", line 63, in get_current_losses errorsret[name] = getattr(self, 'loss' + name).data.cpu().numpy() AttributeError: 'RegistrationModel' object has no attribute 'loss_total' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "train.py", line 71, in model.update_learning_rate(opt, float(model.get_current_losses()["total"])) File "F:\Lzy\unsupervised-medical-image-segmentation-master\unsupervised-medical-image-segmentation-master\models\base_model.py", line 65, in get_current_losses errorsret[name] = getattr(self, 'loss' + name) AttributeError: 'RegistrationModel' object has no attribute 'loss_total'

Hi. Thanks for using our code. This seems like a minor error. Could you please go to line 135 in ./models/registration_model_contrastive_learning.py and set a breakpoint (or simple print self.loss_total) to debug? Thanks for your prompt response. It is a minor error ,because there was something wrong with my dataset. The program is running now. Thanks again for your sharing.