def on_max_iou(old_val, new_val): print ">>> IOU Increased from %s to %s" % (old_val, new_val) ttu.save_network(trial, "best", network) trial.store_important("best_valid_iou", new_val)
valid_chunk = valid_gen.next() import theano import treeano import canopy import canopy.sandbox.monitor_ui print "Making new model." model = make_model(params) print(model) network = model.network() # build eagerly to share weights network.build() # to make sure network is serializable ttu.save_network(trial, "initial", network) # Validation valid_fn = canopy.handled_fn( network, [ canopy.handlers.time_call(key="valid_time"), canopy.handlers.override_hyperparameters( deterministic=True, bn_use_moving_stats=False, ), canopy.handlers.evaluate_monitoring_variables(fmt="valid_%s"), canopy.handlers.chunk_variables(batch_size=params.batch_size, variables=["x", "y"]) ], inputs={"x": "x", "y": "y"},