text_plain_output_1.png
from PIL import Image

import cv2

import numpy as np

import os

infectados = os.listdir('../input/cell_images/cell_images/Parasitized/')
saudaveis = os.listdir('../input/cell_images/cell_images/Uninfected/')

data = []
labels = []
for i in infectados:
    try:
        image = cv2.imread('../input/cell_images/cell_images/Parasitized/' + i)
        image_array = Image.fromarray(image, 'RGB')
        resize_img = image_array.resize((50, 50))
        rotated30 = resize_img.rotate(30)
        rotated60 = resize_img.rotate(60)
        blur = cv2.blur(np.array(resize_img), (10, 10))
        data.append(np.array(resize_img))
        data.append(np.array(rotated30))
        data.append(np.array(rotated60))
        data.append(np.array(blur))
        labels.append(1)
        labels.append(1)
        labels.append(1)
        labels.append(1)
    except AttributeError:
        print('')
for s in saudaveis:
    try:
        image = cv2.imread('../input/cell_images/cell_images/Uninfected/' + s)
        image_array = Image.fromarray(image, 'RGB')
        resize_img = image_array.resize((50, 50))
        rotated30 = resize_img.rotate(30)
        rotated60 = resize_img.rotate(60)
        data.append(np.array(resize_img))
        data.append(np.array(rotated30))
        data.append(np.array(rotated60))
        labels.append(0)
        labels.append(0)
        labels.append(0)
    except AttributeError:
        print('')