Spaces:
				
			
			
	
			
			
		Build error
		
	
	
	
			
			
	
	
	
	
		
		
		Build error
		
	temp
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -47,8 +47,8 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50): 
     | 
|
| 47 | 
         
             
                im1_tensor = transform(im1).unsqueeze(0)
         
     | 
| 48 | 
         
             
                im2_tensor = transform(im2).unsqueeze(0)
         
     | 
| 49 | 
         | 
| 50 | 
         
            -
                 
     | 
| 51 | 
         
            -
                 
     | 
| 52 | 
         | 
| 53 | 
         
             
                # extract features
         
     | 
| 54 | 
         
             
                with torch.no_grad():
         
     | 
| 
         @@ -83,7 +83,7 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50): 
     | 
|
| 83 | 
         | 
| 84 | 
         | 
| 85 | 
         
             
                fin_img = []
         
     | 
| 86 | 
         
            -
                img1rsz = np.copy( 
     | 
| 87 | 
         
             
                print(img1rsz.size)
         
     | 
| 88 | 
         
             
                for j, att in enumerate(all_att_bin1):
         
     | 
| 89 | 
         
             
                    att = cv2.resize(att, im1.size, interpolation=cv2.INTER_NEAREST)
         
     | 
| 
         @@ -99,7 +99,7 @@ def generate_matching_superfeatures(im1, im2, scale_id=6, threshold=50): 
     | 
|
| 99 | 
         
             
                        img1rsz[m,n, :] = col_[::-1]   
         
     | 
| 100 | 
         
             
                fin_img.append(img1rsz)
         
     | 
| 101 | 
         | 
| 102 | 
         
            -
                img2rsz = np.copy( 
     | 
| 103 | 
         
             
                for j, att in enumerate(all_att_bin2):
         
     | 
| 104 | 
         
             
                    att = cv2.resize(att, im2.size, interpolation=cv2.INTER_NEAREST)
         
     | 
| 105 | 
         
             
                    # att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
         
     | 
| 
         @@ -139,7 +139,8 @@ iface = gr.Interface( 
     | 
|
| 139 | 
         
             
                    gr.inputs.Image(shape=(1024, 1024), type="pil"),
         
     | 
| 140 | 
         
             
                    gr.inputs.Slider(minimum=1, maximum=7, step=1, default=2, label="Scale"),
         
     | 
| 141 | 
         
             
                    gr.inputs.Slider(minimum=1, maximum=255, step=25, default=50, label="Binarizatio Threshold")],
         
     | 
| 142 | 
         
            -
                outputs="plot",
         
     | 
| 
         | 
|
| 143 | 
         
             
                enable_queue=True,
         
     | 
| 144 | 
         
             
                title=title,
         
     | 
| 145 | 
         
             
                description=description,
         
     | 
| 
         | 
|
| 47 | 
         
             
                im1_tensor = transform(im1).unsqueeze(0)
         
     | 
| 48 | 
         
             
                im2_tensor = transform(im2).unsqueeze(0)
         
     | 
| 49 | 
         | 
| 50 | 
         
            +
                im1_cv = cv2.imread(im1)
         
     | 
| 51 | 
         
            +
                im2_cv = cv2.imread(im2)
         
     | 
| 52 | 
         | 
| 53 | 
         
             
                # extract features
         
     | 
| 54 | 
         
             
                with torch.no_grad():
         
     | 
| 
         | 
|
| 83 | 
         | 
| 84 | 
         | 
| 85 | 
         
             
                fin_img = []
         
     | 
| 86 | 
         
            +
                img1rsz = np.copy(im1_cv)
         
     | 
| 87 | 
         
             
                print(img1rsz.size)
         
     | 
| 88 | 
         
             
                for j, att in enumerate(all_att_bin1):
         
     | 
| 89 | 
         
             
                    att = cv2.resize(att, im1.size, interpolation=cv2.INTER_NEAREST)
         
     | 
| 
         | 
|
| 99 | 
         
             
                        img1rsz[m,n, :] = col_[::-1]   
         
     | 
| 100 | 
         
             
                fin_img.append(img1rsz)
         
     | 
| 101 | 
         | 
| 102 | 
         
            +
                img2rsz = np.copy(im1_cv)
         
     | 
| 103 | 
         
             
                for j, att in enumerate(all_att_bin2):
         
     | 
| 104 | 
         
             
                    att = cv2.resize(att, im2.size, interpolation=cv2.INTER_NEAREST)
         
     | 
| 105 | 
         
             
                    # att = cv2.resize(att, imgz[i].shape[:2][::-1], interpolation=cv2.INTER_CUBIC)
         
     | 
| 
         | 
|
| 139 | 
         
             
                    gr.inputs.Image(shape=(1024, 1024), type="pil"),
         
     | 
| 140 | 
         
             
                    gr.inputs.Slider(minimum=1, maximum=7, step=1, default=2, label="Scale"),
         
     | 
| 141 | 
         
             
                    gr.inputs.Slider(minimum=1, maximum=255, step=25, default=50, label="Binarizatio Threshold")],
         
     | 
| 142 | 
         
            +
                # outputs="plot",
         
     | 
| 143 | 
         
            +
                outputs=gr.outputs.Image(shape=(1024,2048), type="plot"),
         
     | 
| 144 | 
         
             
                enable_queue=True,
         
     | 
| 145 | 
         
             
                title=title,
         
     | 
| 146 | 
         
             
                description=description,
         
     |