Skip to content

Instantly share code, notes, and snippets.

@vivekpadia70
Created April 1, 2020 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivekpadia70/785d6afa339bee2fd14416771d4d5637 to your computer and use it in GitHub Desktop.
Save vivekpadia70/785d6afa339bee2fd14416771d4d5637 to your computer and use it in GitHub Desktop.
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