Commit 41fcb5bf authored by mihaivanea's avatar mihaivanea
Browse files

Having trouble with the format of loaded cross validation arrays.

parent 74e981e2
......@@ -28,6 +28,7 @@ def convert_to_cartesian(ellip_array):
y2 = c_y + major_r
box = [round(p, 4) for p in (x1, y1, x2, y2)]
cartesian_output.append(box)
break
cartesian_output = np.array(cartesian_output)
return cartesian_output
......
#!/vol/bitbucket/mv1315/urop/venv/bin/python3.5
import numpy as np
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D
from keras.layers import Input, Dense, Flatten, GlobalAveragePooling2D
from keras import backend as K
from generate_arrays_fddb import load_arrays_fddb
from keras.wrappers.scikit_learn import KerasRegressor
......@@ -11,6 +12,7 @@ from keras.optimizers import RMSprop
from keras.losses import categorical_crossentropy, mean_squared_error
# instantiate a ResNet model with pre-trained wights
base_model = ResNet50(
include_top=True,
weights="imagenet",
......@@ -34,6 +36,8 @@ classifier_branch = Dense(
1000,
activation="softmax")(x)
#classifier_out = resnet_model(classifier_branch)
# Add a regression layer to be trained on FDDB.
regression_branch = Dense(
4,
......@@ -41,10 +45,12 @@ regression_branch = Dense(
kernel_initializer="normal",
activation="relu")(x)
#regression_out = resnet_model(regression_branch)
# my model to train
model = Model(
inputs=[base_model.input],
outputs=[classifier_branch, regression_branch])
inputs=base_model.input,
output=[classifier_branch, regression_branch])
# Freeze the convolutional layers of ResNet
# Train only the two added top layers.
......@@ -87,15 +93,8 @@ model.fit(
batch_size=16,
epochs=10,
verbose=1,
validation_data=(x_valid, y_valid))
validation_data=(x_valid, y_valid)
)
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