Пример #1
0
    model_learning_rate = 0.1**5
    model_512 = define_epinet(round(img_scale * image_h),
                              round(img_scale * image_w),
                              Setting02_AngualrViews, model_conv_depth,
                              model_filt_num, model_learning_rate)
    ''' Model Initialization '''

    model_512.load_weights(path_weight)
    dum_sz = model_512.input_shape[0]
    dum = np.zeros((1, dum_sz[1], dum_sz[2], dum_sz[3]), dtype=np.float32)
    dummy = model_512.predict([dum, dum, dum, dum], batch_size=1)
    """  Depth Estimation  """
    for image_path in dir_LFimages:

        (val_90d, val_0d, val_45d,
         val_M45d) = make_multiinput(image_path, image_h, image_w,
                                     Setting02_AngualrViews)

        # print(val_90d.shape)
        # exit()
        start = time.time()

        # predict
        val_output_tmp = model_512.predict([
            val_90d[:, ::img_scale_inv, ::img_scale_inv],
            val_0d[:, ::img_scale_inv, ::img_scale_inv],
            val_45d[:, ::img_scale_inv, ::img_scale_inv],
            val_M45d[:, ::img_scale_inv, ::img_scale_inv]
        ],
                                           batch_size=1)

        runtime = time.time() - start
Пример #2
0
    center_offset = (0, 0)
#    center_os_x = center_x - (an - 1)//2
#    center_os_y = center_y - (an - 1)//2
#    center_offset = (center_os_x, center_os_y)

#if subsample_type == "center":

print("center offset: ")
print(center_offset)
for image_path in dir_LFimages:

    (val_90d, val_0d, val_45d, val_M45d,
     impaths) = make_multiinput(image_path,
                                image_h,
                                image_w,
                                Setting02_AngualrViews,
                                ds=ds,
                                center_offsets=center_offset,
                                net_type="original",
                                corner_code=None)

    start = time.clock()

    all_outputs = model.predict([
        val_90d[:, ::img_scale_inv, ::img_scale_inv],
        val_0d[:, ::img_scale_inv, ::img_scale_inv],
        val_45d[:, ::img_scale_inv, ::img_scale_inv],
        val_M45d[:, ::img_scale_inv, ::img_scale_inv]
    ],
                                batch_size=1)
    # predict
    val_output_tmp = all_outputs[-1]
Пример #3
0
#      write_graph=True, write_images=True)    
#
#tbCallback.set_model(model_512)
"""  Depth Estimation  """

for center_coord in center_coords:
    center_offset = infer_cos_from_cc(center_coord,ds)
#for center_offset in center_offsets:
    subsample = ("center",center_offset) #"center" #"upperleft"
    print ( "center offset: " )
    print ( center_offset )
#    for image_path in dir_LFimages:
    for sample in sample_names:    
    
        (val_90d , val_0d, val_45d, val_M45d,impaths)=make_multiinput(sample,
                                                             Setting02_AngualrViews,
                                                             ds=ds, center_offsets = center_offset, net_type='original', 
                                                             crop_size=crop_size, crop_or_resize=crop_or_resize)
    
        start=time.clock() 
        
        # predict
        val_output_tmp=model_512.predict([ val_90d[:,::img_scale_inv,::img_scale_inv], 
                                            val_0d[:,::img_scale_inv,::img_scale_inv], 
                                           val_45d[:,::img_scale_inv,::img_scale_inv], 
                                          val_M45d[:,::img_scale_inv,::img_scale_inv]], 
                                          batch_size=1); 
                                          
        runtime=time.clock() - start
        plt.imshow(val_output_tmp[0,:,:,0])
        
        iar_center, iac_center = center_coord
Пример #4
0
    center_offset = infer_cos_from_corner(corner_coords,
                                          corner_code,
                                          an=ds.iar_max,
                                          model_cw=model_cw)

    print("center offset: ")
    print(center_offset)
    print("corner code:")
    print(corner_code)
    for sample in samples:

        (val_90d, val_0d, val_M45d,
         impaths) = make_multiinput(sample,
                                    Setting02_AngualrViews,
                                    ds=ds,
                                    center_offsets=center_offset,
                                    net_type="corner",
                                    corner_code=corner_code)

        start = time.clock()

        # predict
        val_output_tmp = model_512.predict([
            val_90d[:, ::img_scale_inv, ::img_scale_inv],
            val_0d[:, ::img_scale_inv, ::img_scale_inv],
            val_M45d[:, ::img_scale_inv, ::img_scale_inv]
        ],
                                           batch_size=1)

        if corner_code == "NE":
            val_output_tmp = np.rot90(val_output_tmp, axes=(2, 1))
Пример #5
0
    model_learning_rate = 0.1**5
    model_512 = define_epinet(int(img_scale_inv * image_h),
                              int(img_scale_inv * image_w), angular_views,
                              model_conv_depth, model_filt_num,
                              model_learning_rate)
    ''' Model Initalization '''

    model_512.load_weights(path_weight)
    dum_sz = model_512.input_shape[0]
    dum = np.zeros((1, dum_sz[1], dum_sz[2], dum_sz[3]), dtype=np.float32)
    dummy = model_512.predict([dum, dum, dum, dum], batch_size=1)
    """  Depth Estimation  """
    for image_path in dir_LFimages:

        (val_90d, val_0d, val_45d,
         val_M45d) = make_multiinput(image_path, image_h, image_w,
                                     angular_views)

        start = time.clock()

        # predict
        val_output_tmp = model_512.predict([
            val_90d[:, ::img_scale_inv, ::img_scale_inv],
            val_0d[:, ::img_scale_inv, ::img_scale_inv],
            val_45d[:, ::img_scale_inv, ::img_scale_inv],
            val_M45d[:, ::img_scale_inv, ::img_scale_inv]
        ],
                                           batch_size=1)

        runtime = time.clock() - start
        plt.imshow(val_output_tmp[0, :, :, 0])
        print("%.5f(s)" % runtime)