xmed-lab / CSS-SemiVideo

IEEE TMI 2022: Cyclical Self-Supervision for Semi-Supervised Ejection Fraction Prediction from Echocardiogram Videos
16 stars 2 forks source link

I can't find "echonet. Models. Rnet2dp1. VideoResNet_ncor" this function #1

Closed kkkabu closed 1 year ago

kkkabu commented 1 year ago

Hello, I'm sorry to bother you. I'd like to ask you some questions

I had this problem when I was running to train the multi-modal LVEF prediction model, I can't find "echonet. Models. Rnet2dp1. VideoResNet_ncor" this function.

image image

The following two errors occur when I use VideoResNet or VideoResNet_kd.

image image

I don't know how to solve this problem. I would like to ask if you have encountered similar situations before and how to solve them. I hope you can provide some help, which will be greatly appreciated. Thank you

ackbar03 commented 1 year ago

Hi,

No problem at all, thanks for your interest!

Sorry about that, the first condition for the if statement should have been deleted. Lines 533-537 should just be

                    reg1.append(all_output.detach().cpu().numpy())

VideoResNet_ncor was something else I was experimenting with. Because it on my server from the last pip3 install I ran it didn't show up when I was testing the uploaded code. I will correct it soon.

The following two errors occur when I use VideoResNet or VideoResNet_kd.

I'm not too sure what you mean by this, is it related to the first problem or something different? The base model should just be echonet.models.rnet2dp1.r2plus1d_18(pretrained=pretrained) declared in line 133 ( https://github.com/xmed-lab/CSS-SemiVideo/blob/e40dcb2aba6f7b0230e4cc2b648725abf94ac113/echonet/utils/video_segin.py#L133 )

Feel free to let me know if there are any other questions!

kkkabu commented 1 year ago

Hi,

No problem at all, thanks for your interest!

Sorry about that, the first condition for the if statement should have been deleted. Lines 533-537 should just be

                    reg1.append(all_output.detach().cpu().numpy())

VideoResNet_ncor was something else I was experimenting with. Because it on my server from the last pip3 install I ran it didn't show up when I was testing the uploaded code. I will correct it soon.

The following two errors occur when I use VideoResNet or VideoResNet_kd.

I'm not too sure what you mean by this, is it related to the first problem or something different? The base model should just be echonet.models.rnet2dp1.r2plus1d_18(pretrained=pretrained) declared in line 133 (

https://github.com/xmed-lab/CSS-SemiVideo/blob/e40dcb2aba6f7b0230e4cc2b648725abf94ac113/echonet/utils/video_segin.py#L133

) Feel free to let me know if there are any other questions!

Thank you very much for your reply, but I still have a problem. When I changed lines 533-537 as you suggested, it shows this error "raise ValueError(ValueError: Found array with 0 sample(s) (shape=(0,)) while a minimum of 1 is required." I don't know how to solve it.

image

Also, I modified the echo.py file earlier. Specifically, line 172 adds”self.fnames = [fn + ".avi" for fn in self.fnames if os.path.splitext(fn)[1] == ""]“, and line 198 deleted ”filename = filename + ".avi"“ Because if I don't change echo.py it will get the following error.

image

I don't know if my modification is the cause of the "raise ValueError(ValueError: Found array with 0 sample(s) (shape=(0,)) while a minimum of 1 is required." error above If possible, I hope to get your advice again. Thank you very much for your reply.

ackbar03 commented 1 year ago

Hi,

Can I check with you, does the program finish the inference process and only encounter the error when calculating the R2/MAE metrics? i.e. Do you see output similar to this before you encounter the error?

image

Also can you check if there are files "temp_inference_test.csv" or "temp_inference_val.csv" in the output system? If there are, delete them first and run it again and see if that works.

Alternatively it could be because the program could not find the video files from your system, although if you are able to run the program until test_epoch_all() it is less likely the case. You could however double check the file paths are correct by uncommenting print(self.fnames) from line 215 in echo.py to see what the list of files are

https://github.com/xmed-lab/CSS-SemiVideo/blob/5707b6085cb61807253710766c816e3cd1ae6a25/echonet/datasets/echo.py#L215

and maybe add print(video_path) to see what the file path is for each iteration.

https://github.com/xmed-lab/CSS-SemiVideo/blob/5707b6085cb61807253710766c816e3cd1ae6a25/echonet/datasets/echo.py#L227

and just double check the files are present in the path.

kkkabu commented 1 year ago

Hi,

Can I check with you, does the program finish the inference process and only encounter the error when calculating the R2/MAE metrics? i.e. Do you see output similar to this before you encounter the error?

image

Also can you check if there are files "temp_inference_test.csv" or "temp_inference_val.csv" in the output system? If there are, delete them first and run it again and see if that works.

Alternatively it could be because the program could not find the video files from your system, although if you are able to run the program until test_epoch_all() it is less likely the case. You could however double check the file paths are correct by uncommenting print(self.fnames) from line 215 in echo.py to see what the list of files are

https://github.com/xmed-lab/CSS-SemiVideo/blob/5707b6085cb61807253710766c816e3cd1ae6a25/echonet/datasets/echo.py#L215

and maybe add print(video_path) to see what the file path is for each iteration.

https://github.com/xmed-lab/CSS-SemiVideo/blob/5707b6085cb61807253710766c816e3cd1ae6a25/echonet/datasets/echo.py#L227

and just double check the files are present in the path.

Hello, thank you very much for your help, this problem has been successfully solved. I found that the “test_predictions.csv” file I generated was empty and the contents were not written properly. This is probably due to the changes I made to the echo.py file, causing fnames not to match properly. The problem was solved when I made another modification so that I could properly generate the "test_predictions.csv" file. Thank you very much for your guidance and help.