Computer Vision News - June 2022

51 Covid Predictor (with code) filename = row["filename"] image_path = os.path.join(IMAGE_PATH,filename) #IMAGE_PATH + filename image_copy_path = os.path.join(TARGET_DIR,filename) #TARGET_DIR + filename shutil.copy2(image_path,image_copy_path) #Copy From IMAGE_PATH to TARGET_DIrectory print("Moving Image",cnt) cnt+=1 print(cnt) Moving Image 0 Moving Image 1 Moving Image 2 Moving Image 3 Moving Image 4 …. 140 # Normal chest X rays from Kaggle Data. import random KAGGLE_FILE_PATH = "Desktop\\chest_xray\\train\\NORMAL" TARGET_NORMAL_DIR = "/content/drive/My Drive/Dataset/Train/Normal" if not os.path.exists(TARGET_NORMAL_DIR): os.mkdir(TARGET_NORMAL_DIR) image_names = os.listdir(KAGGLE_FILE_PATH) #COntains list of all image names image_names random.shuffle(image_names) #it will randomly shuffle names in list for i in range(141): image_name = image_names[i] image_path = os.path.join(KAGGLE_FILE_PATH,image_name) target_path = os.path.join(TARGET_NORMAL_DIR,image_name) shutil.copy2(image_path,target_path) print("Moved",i) from google.colab import drive drive.mount('/content/drive') Enter your authorization code: ·········· Mounted at /content/drive TRAIN_PATH ="/content/drive/My Drive/Dataset/Train" VAL_PATH = "/content/drive/My Drive/Dataset/Val"

RkJQdWJsaXNoZXIy NTc3NzU=