ieee8023 / covid-chestxray-dataset

We are building an open database of COVID-19 cases with chest X-ray or CT images.
2.99k stars 1.28k forks source link

Minimal jupyter notebook to train models #15

Open rcillavicomtech opened 4 years ago

rcillavicomtech commented 4 years ago

Hi, I'm a deep learning researcher from Spain. I have created a minimal jupyter notebook to train with the images from your repo.

https://drive.google.com/file/d/19T_qebLa1keUNpkp7FDNEBmsNRQUVtfJ/view?usp=sharing

I want to experiment with visual attention models on next days. Rodrigo

ieee8023 commented 4 years ago

Can you make that link public? Or maybe just upload the notebook to this issue page?

rcillavicomtech commented 4 years ago

Now the link should work. I attach the notebook too.

COVID_19.ipynb.txt

ieee8023 commented 4 years ago

Cool! Looks good! I had just released the torchxrayvision code! I have been doing something similar but I wasn't able to get good prediction performance. Can you include an AUC calculation on the resulting model? Also, I would expect monitoring test performance here as you do would cause you to overfit. Maybe leave out a few cases that you only test the final model on.

rcillavicomtech commented 4 years ago

Yes, good ideas to keep improving it. I'll do it when I have spare time during the week. Perhaps something like a VAE-GAN data augmentation approach could be useful to.

jovenwayfarer commented 4 years ago

Thanks for sharing, In dataset class we have 9 labels, what they stand for? And in your code we have 2 classes, could you explain it? Thanks!!!

rcillavicomtech commented 4 years ago

@jovenwayfarer Labels are binary. My code is to predict COVID19 status stored at column 2. Tomorrow I'll improve it with some ideas....

RazaGR commented 4 years ago

@rcillavicomtech I tested your code 4 days ago, but due to CUDA usage in the snippet I had to run on colab, because I don't have access to any Nvidia GPU, so it took quiet some time to train the model... I am also trying to find more datasets, I look forward of your improved code

jovenwayfarer commented 4 years ago

model=xrv.models.DenseNet(num_classes=2).cuda() is it densenet121? it is pretrained? if yes, on what? Thnaks again for the notebook

jovenwayfarer commented 4 years ago

@ieee8023 Hi, could you help? If I load a model like below model=xrv.models.DenseNet(num_classes=2).cuda() is it densenet121? it is pretrained? if yes, on what?

ieee8023 commented 4 years ago

You can view the code here: https://github.com/mlmed/torchxrayvision/

If you specify weights you will get pretrained DenseNet 121 models based on the models trained for this paper: https://arxiv.org/abs/2002.02497

dzlab commented 4 years ago

@rcillavicomtech not sure to understand your training, what does PA and lab stands for?

        inputs=data['PA'].cuda()
        labels=data['lab'].long().cuda()
Qing21 commented 3 years ago

@rcillavicomtech Thank you for your great work! When I used the covid dataset the same way as yours, I encountered an assertion error:

Traceback (most recent call last): File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/COVID-Test.py", line 222, in train(model, train_dataloader, optimizer, criterion) File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/COVID-Test.py", line 53, in train for batch_idx, samples in enumerate(train_dataloader, 0): File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/dataset.py", line 304, in getitem return self.dataset[self.idxs[idx]] File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/dataset.py", line 247, in getitem sample["img"] = self.transform(sample["img"]) File "/Users/opt/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 61, in call img = t(img) File "/Users/opt/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/Users/Documents/ProgramData/Pycharm/EfficientNet-PyTorch-master/utilsForCovid.py", line 35, in forward assert isinstance(x, torch.Tensor) AssertionError

Can anyone help with this problem? Thank you in advance!