echonet / dynamic

EchoNet-Dynamic is a deep learning model for assessing cardiac function in echocardiogram videos.
https://echonet.github.io/dynamic
Other
452 stars 162 forks source link

Error in Initialization Notebook #40

Open gt-madanb opened 2 years ago

gt-madanb commented 2 years ago

Thank you for the wonderful repo. I am trying to do an external test with echonet dynamic dataset.

RuntimeError: Caught RuntimeError in DataLoader worker process 1.
 0%|                                                                                            | 0/2 [00:00<?, ?it/s]
loading weights from  D:\stanford_AIMI\weights\r2plus1d_18_32_2_pretrained
cuda is not available, cpu weights
EXTERNAL_TEST ['0X1AADD51FAA94E4E.avi', '0X1AB987597AF39E3B.avi', '0X1ABAD3C70E6D0F27.avi', '0X1ABE578AF99E8F3E.avi', '0X1ACB73BE8C1F2C0C.avi', '0X1ACC87A912A57EDA.avi', '0X1AD23DC4055A4B6A.avi', '0X1AD3CDEC841DA50.avi', '0X1ADDEA184822F38E.avi', '0X1ADEAFA4D59610C8.avi', 'avi']
 50%|██████████████████████████████████████████                                          | 1/2 [00:02<00:02,  2.53s/it]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-e618c2550cd5> in <module>
     37 print(ds.split, ds.fnames)
     38 
---> 39 mean, std = echonet.utils.get_mean_and_std(ds)
     40 
     41 kwargs = {"target_type": "EF",
Original Traceback (most recent call last):
  File "C:\Users\MadanB\anaconda3\lib\site-packages\torch\utils\data\_utils\worker.py", line 202, in _worker_loop
    data = fetcher.fetch(index)
  File "C:\Users\MadanB\anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 47, in fetch
    return self.collate_fn(data)
  File "C:\Users\MadanB\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 83, in default_collate
    return [default_collate(samples) for samples in transposed]
  File "C:\Users\MadanB\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 83, in <listcomp>
    return [default_collate(samples) for samples in transposed]
  File "C:\Users\MadanB\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 63, in default_collate
    return default_collate([torch.as_tensor(b) for b in batch])
  File "C:\Users\MadanB\anaconda3\lib\site-packages\torch\utils\data\_utils\collate.py", line 55, in default_collate
    return torch.stack(batch, 0, out=out)
RuntimeError: stack expects each tensor to be equal size, but got [3, 16, 112, 112] at entry 0 and [3, 16, 0, 0] at entry 2
LitMSCTBB commented 1 year ago

As seen from the printing of EXTERNAL_TEST ['0X1AADD51FAA94E4E.avi', '0X1AB987597AF39E3B.avi', '0X1ABAD3C70E6D0F27.avi', '0X1ABE578AF99E8F3E.avi', '0X1ACB73BE8C1F2C0C.avi', '0X1ACC87A912A57EDA.avi', '0X1AD23DC4055A4B6A.avi', '0X1AD3CDEC841DA50.avi', '0X1ADDEA184822F38E.avi', '0X1ADEAFA4D59610C8.avi', 'avi'], you likely have some subfolder called avi in your videos folder, and the dataset initialization is treating it as a video file thus leading it to believe that the frame height and width is 0. Move the folder out and you should be good.

This part is the culprit:

if self.split == "EXTERNAL_TEST":
            self.fnames = sorted(os.listdir(self.external_test_location))

Should be a simple fix to only look for files that end in ".avi". Can mention this in a pull request in the future.