예제 #1
0
    else:
        im_file = fuse_radio_ir_4_pred(args.radio_fits,
                                       args.ir_png,
                                       model=args.model)
        vis_file = args.ir_png
    #print("im_file", im_file)
    if (im_file is None):
        print("Error in generating contours")
        sys.exit(1)
    hard_code_cfg()
    net = get_network('rgz_test')
    iter_num = 80000
    if ('D3' == args.model):
        iter_num = 60000
    model_weight = osp.join(
        get_rgz_root(), 'data/pretrained_model/rgz/%s/VGGnet_fast_rcnn-%d' %
        (args.model, iter_num))
    if (not osp.exists(model_weight + '.index')):
        print(
            "Fail to load rgz model, have you done \'python download_data.py\' already?"
        )
        sys.exit(1)

    saver = tf.train.Saver()
    sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
    sys.stdout.write('Loading RGZ model from {:s}... '.format(model_weight))
    sys.stdout.flush()
    stt = time.time()
    saver.restore(sess, model_weight)
    print(("Done in %.3f seconds" % (time.time() - stt)))
    sys.stdout.write("Detecting radio sources... ")
예제 #2
0
    if ('D1' == args.model):
        im_file = args.radio_png
        vis_file = args.radio_png
    else:
        im_file = fuse_radio_ir_4_pred(args.radio_fits, args.ir_png, model=args.model)
        vis_file = args.ir_png
    #print("im_file", im_file)
    if (im_file is None):
        print("Error in generating contours")
        sys.exit(1)
    hard_code_cfg()
    net = get_network('rgz_test')
    iter_num = 80000
    if ('D3' == args.model):
        iter_num = 60000
    model_weight = osp.join(get_rgz_root(), 'data/pretrained_model/rgz/%s/VGGnet_fast_rcnn-%d' % (args.model, iter_num))
    if (not osp.exists(model_weight + '.index')):
        print("Fail to load rgz model, have you done \'python download_data.py\' already?")
        sys.exit(1)

    saver = tf.train.Saver()
    sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
    sys.stdout.write('Loading RGZ model from {:s}... '.format(model_weight))
    sys.stdout.flush()
    stt = time.time()
    saver.restore(sess, model_weight)
    print("Done in %.3f seconds" % (time.time() - stt))
    sys.stdout.write("Detecting radio sources... ")
    sys.stdout.flush()
    ret = demo(sess, net, im_file, vis_file, args.radio_fits, conf_thresh=args.conf_thresh,
               eval_class=(not args.eval_eoi))