Ejemplo n.º 1
0
def main(args):

    if not (args.run_train or args.run_test or args.run_reshape
            or args.download_data):
        print(
            'Set atleast one of the options --train | --test | --reshape | --download-data'
        )
        parser.print_help()
        return

    if args.run_test or args.run_train or args.run_reshape:
        session = get_session(args.gpu_limit)

    if args.run_train:
        trainer = HEDTrainer(args.config_file)
        trainer.setup()
        trainer.run(session)

    if args.run_test:
        tester = HEDTester(args.config_file)
        tester.setup(session)
        tester.run(session)

    if args.run_reshape:
        reshaper = HEDReshaper(args.config_file)
        reshaper.setup(session)
        reshaper.run(session)

    if args.download_data:

        io = IO()
        cfgs = io.read_yaml_file(args.config_file)
        io.download_data(cfgs['rar_file'], cfgs['download_path'])
Ejemplo n.º 2
0
 def start(self, args):
     io = IO()
     self.cfgs = io.read_yaml_file(args.config_file)
     self.model = Vgg16(self.cfgs, run='testing')
     meta_model_file = "/Users/csrproject/edge/holy-edge/hed/models/hed-model-5001"
     saver = tf.train.Saver()
     session = self.get_session(args.gpu_limit)
     saver.restore(session, meta_model_file)
     self.model.setup_testing(session)
     im = self.fetch_img()
     edgemap = session.run(self.model.predictions,
                           feed_dict={self.model.images: [im]})
     self.save_egdemaps(edgemap)