text_plain_output_1.png
from torch.utils.data import DataLoader

from torchvision.datasets import ImageFolder

from torchvision.transforms import Compose, CenterCrop, ToTensor,ColorJitter

import glob

import os

import shutil

import os
import glob
import shutil
train_data_dir = '/kaggle/input/1056lab-covid19-chest-xray-recognit/train'
working_dir = '/kaggle/working'
os.makedirs(working_dir + '/train')
os.makedirs(working_dir + '/train/COVID/')
os.makedirs(working_dir + '/train/Not_COVID/')
path_list = glob.glob(train_data_dir + '/COVID/*.png')
for path in path_list:
    shutil.copy(path, working_dir + '/train/COVID/')
for dir in ['Lung_Opacity', 'Normal', 'Viral_Pneumonia']:
    path_list = glob.glob(train_data_dir + '/' + dir + '/*.png')
    for path in path_list:
        shutil.copy(path, working_dir + '/train/Not_COVID/')

from torchvision.transforms import Compose, CenterCrop, ToTensor, ColorJitter
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
train_data_dir = '/kaggle/working/train'
transform = Compose([CenterCrop(224), ToTensor()])
transforms = ColorJitter(contrast=1)
train_data = ImageFolder(train_data_dir, transform=transform)
train_loader = DataLoader(train_data, batch_size=32, shuffle=True)
class_names = train_data.classes
print(class_names)