Exemplo n.º 1
0
                                    name="prediction")
        pred_annotation = tf.expand_dims(pred_annotation, axis=3)
        with tf.variable_scope("infer_decode"):
            decoder_net = cls.unet(softmax_image_segment, keep_prob,
                                   phase_train, 3, flags.num_layers,
                                   flags.debug)
        reconstruct_image = decoder_net['segment']

        return pred_annotation, image_segment_logits, reconstruct_image


if __name__ == '__main__':
    """
    Init network and train.
    """
    flags = tf_flags()
    net = Wnet_naive(flags)

    print("Setting up dataset reader")
    train_dataset_reader, validation_dataset_reader, test_dataset_reader = create_BatchDatset(
        './soccer')

    if "train" in flags.mode:
        net.train_net(train_dataset_reader, validation_dataset_reader)

    elif "visualize" in flags.mode:
        valid_images, preds = net.visualize_pred(validation_dataset_reader)

    elif "test" in flags.mode:
        test_images, preds = net.plot_segmentation_on_test(test_dataset_reader)
Exemplo n.º 2
0
                      (datetime.datetime.now(), valid_loss))

                # add validation loss to TensorBoard
                self.validation_writer.add_summary(summary_sva, itr)
                self.saver.save(
                    self.sess, os.path.join(self.flags.logs_dir, "model.ckpt"),
                    itr)
        return


if __name__ == '__main__':
    """
    Init network and train. 
    """

    flags = tf_flags()
    net = Wnet_bright(flags)

    if flags.mode == "test":
        test_images, preds = net.plot_segmentation_under_test_dir()

    else:
        print("Setting up dataset reader")
        train_dataset_reader, validation_dataset_reader = create_BatchDatset()

        if flags.mode == "train":
            net.train_net(train_dataset_reader, validation_dataset_reader)

        elif flags.mode == "visualize":
            valid_images, preds = net.visaulize_pred(validation_dataset_reader)
Exemplo n.º 3
0
                                   flags.debug)
        reconstruct_ice = decoder_net['segment']

        return pred_annotation, image_segment_logits, reconstruct_ice


if __name__ == '__main__':
    """
    Init network and train.
    """
    os.environ['CUDA_VISIBLE_DEVICES'] = '0'

    flags = tf_flags()
    net = Wnet_ice(flags)

    print("Setting up dataset reader")
    train_dataset_reader, validation_dataset_reader, test_dataset_reader = \
            create_BatchDatset('./soccer/ice',
                               image_dir='images',
                               annotation_dir='segmentations',
                               ftype='png')

    if "train" in flags.mode:
        net.train_net(train_dataset_reader, validation_dataset_reader)

    elif "visualize" in flags.mode:
        valid_images, preds = net.visualize_pred(validation_dataset_reader)

    elif "test" in flags.mode:
        test_images, preds = net.plot_segmentation_on_test(test_dataset_reader)