Commit 98b97c80 authored by mihaivanea's avatar mihaivanea
Browse files

Processed images into 224x224 size

parent 9ea6a518
......@@ -9,6 +9,7 @@ import numpy as np
from skimage.io import imread
from os import system
from sys import stdout, argv
from PIL import Image
# generate arrays only for a minibatch for now"
path = "../fddb/FDDB-folds/FDDB-fold-01-ellipseList.txt"
......@@ -33,10 +34,20 @@ def generate_arrays_fddb(path):
no_labels, labels = (l for l in benchmark.tokenise(path))
for lb in labels:
img = lb[0]
data = imread("../fddb/" + img + ".jpg")
print(len(data))
yield data, convert_to_cartesian(lb[2])
img_path = "../fddb/" + img + ".jpg"
img = Image.open(img_path)
img = img.resize((224, 224), Image.ANTIALIAS)
img.load()
data = np.asarray(img, dtype="float32")
if len(data.shape) == 3:
yield data, convert_to_cartesian(lb[2])
#generator = generate_arrays_fddb(path)
#
#for g in generator:
# print(g)
#print("DONE")
#
#for g in generator:
# print(g)
#print("DONE")
......@@ -30,14 +30,14 @@ model.compile(optimizer='rmsprop', loss='categorical_crossentropy')
fddb_path = "../fddb/FDDB-folds/FDDB-fold-01-ellipseList.txt"
# train the model on the new data for a few epochs
try:
model.fit_generator(
generator=generate_arrays_fddb(fddb_path),
steps_per_epoch=1000, epochs=10
)
except Exception as e:
print(e)
## train the model on the new data for a few epochs
#try:
# model.fit_generator(
# generator=generate_arrays_fddb(fddb_path),
# steps_per_epoch=1000, epochs=10
# )
#except Exception as e:
# print(e)
# at this point, the top layers are well trained and we can start fine-tuning
# convolutional layers from inception V3. We will freeze the bottom N layers
......@@ -45,9 +45,10 @@ except Exception as e:
# let's visualize layer names and layer indices to see how many layers
# we should freeze:
#print(base_model.input.name)
#for i, layer in enumerate(base_model.layers):
# print(i, layer.name)
#print(base_model.output)
print(base_model.input_shape)
print(base_model.output_shape)
for i, layer in enumerate(base_model.layers):
print(i, layer.name)
print(base_model.output)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment