AI
My interest should have been greater, after all, that was exactly why I had chosen my combination of subjects (biology, psychology, mathematics/computer science). But the findings from psychology (mental disorders) and computer science (black box) left me pondering.
“I sickened as I read. ‘Hateful day when I received life!’ I exclaimed in agony. ‘Cursed creator! Why did you form a monster so hideous that even you turned from me in disgust? God in pity made man beautiful and alluring, after his own image; but my form is a filthy type of your’s, more horrid from its very resemblance.” M. Shelley
Segmentation
Based on The Oxford-IIIT Pet Dataset.
O. M. Parkhi, A. Vedaldi, A. Zisserman, C. V. Jawahar (2012) Cats and Dogs. IEEE Conference on Computer Vision and Pattern Recognition 2012.
See for more information: Image segmentation | TensorFlow Core
#!python
import tensorflow as tf
import numpy as np
from PIL import Image
import osmodel = tf.keras.models.load_model ("model.h5")
IMG_DIR = "Img"
IMG_SIZE = 128def get_image(filename):
img_data = Image.open(filename)
img_data.thumbnail((IMG_SIZE, IMG_SIZE))
img_data = np.array(img_data.convert("RGB"))
img_data = tf.cast(img_data, tf.float32) / 255.0
return img_datai = 0
with os.scandir(IMG_DIR) as it:
images = np.empty((len(list(it)), IMG_SIZE, IMG_SIZE, 3), dtype="float32")
with os.scandir(IMG_DIR) as it:
for entry in it:
if entry.name.endswith(".png") and entry.is_file():
images[i,] = get_image(entry.path)
i += 1predictions = model.predict(images)
pred_mask = tf.math.argmax(predictions, axis=-1)
predictions = pred_mask[..., tf.newaxis]i = 0
with os.scandir(IMG_DIR) as it:
for entry in it:
if entry.name.endswith(".png") and entry.is_file():
img_data = tf.keras.utils.array_to_img(predictions[i,])
img_data.save("Seg/"+entry.name, "PNG")
i += 1
AI research groups