Created
April 1, 2020 08:52
-
-
Save vivekpadia70/785d6afa339bee2fd14416771d4d5637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data=[] | |
labels=[] | |
Parasitized=os.listdir("~/Downloads/cell_images/Parasitized/") | |
for a in Parasitized: | |
try: | |
image=cv2.imread("~/Downloads/cell_images/Parasitized/"+a) | |
image_from_array = Image.fromarray(image, 'RGB') | |
size_image = image_from_array.resize((50, 50)) | |
data.append(np.array(size_image)) | |
labels.append(0) | |
except AttributeError as e: | |
print(e) | |
Uninfected=os.listdir("~/Downloads/cell_images/Uninfected/") | |
for b in Uninfected: | |
try: | |
image=cv2.imread("~/Downloads/cell_images/Uninfected/"+b) | |
image_from_array = Image.fromarray(image, 'RGB') | |
size_image = image_from_array.resize((50, 50)) | |
data.append(np.array(size_image)) | |
labels.append(1) | |
except AttributeError as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment