File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ def predict_labels(model):
265
265
shuffle = False ,
266
266
class_mode = None )
267
267
268
- base_path = "../data/test /test/"
268
+ base_path = test_data_dir + " /test/"
269
269
270
270
with open ("prediction.csv" , "w" ) as f :
271
271
p_writer = csv .writer (f , delimiter = ',' , lineterminator = '\n ' )
@@ -281,7 +281,18 @@ def predict_labels(model):
281
281
shuffle = False )
282
282
prediction = model .predict_generator (test_generator , 1 )[0 ][0 ]
283
283
p_writer .writerow ([pic_id , prediction ])
284
-
284
+
285
+ def load_model ():
286
+ """Loads a model from an earlier run"""
287
+
288
+ json_file = open ('final_model_architecture.json' , 'r' )
289
+ model_json = json_file .read ()
290
+ json_file .close ()
291
+ model = model_from_json (model_json )
292
+ model .load_weights ('final_weights.h5' )
293
+ print "Model Loaded."
294
+
295
+ return model
285
296
286
297
if __name__ == "__main__" :
287
298
save_bottlebeck_features ()
You can’t perform that action at this time.
0 commit comments