Commit 
							
							Β·
						
						9aceed2
	
1
								Parent(s):
							
							3b88fc9
								
instance norm fix
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -3,6 +3,7 @@ from huggingface_hub import Repository 
     | 
|
| 3 | 
         | 
| 4 | 
         
             
            from utils.utils import norm_crop, estimate_norm, inverse_estimate_norm, transform_landmark_points, get_lm
         
     | 
| 5 | 
         
             
            from networks.layers import AdaIN, AdaptiveAttention
         
     | 
| 
         | 
|
| 6 | 
         
             
            import numpy as np
         
     | 
| 7 | 
         
             
            import cv2
         
     | 
| 8 | 
         
             
            from scipy.ndimage import gaussian_filter
         
     | 
| 
         @@ -30,7 +31,9 @@ ArcFace = load_model("arcface_model/arc_res50.h5") 
     | 
|
| 30 | 
         | 
| 31 | 
         
             
            g_repo = Repository(local_dir="g_model", clone_from="felixrosberg/affa_f",
         
     | 
| 32 | 
         
             
                                private=True, use_auth_token="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")
         
     | 
| 33 | 
         
            -
            G = load_model("g_model/affa_f_demo.h5", custom_objects={"AdaIN": AdaIN, 
     | 
| 
         | 
|
| 
         | 
|
| 34 | 
         | 
| 35 | 
         
             
            blend_mask_base = np.zeros(shape=(256, 256, 1))
         
     | 
| 36 | 
         
             
            blend_mask_base[100:240, 32:224] = 1
         
     | 
| 
         | 
|
| 3 | 
         | 
| 4 | 
         
             
            from utils.utils import norm_crop, estimate_norm, inverse_estimate_norm, transform_landmark_points, get_lm
         
     | 
| 5 | 
         
             
            from networks.layers import AdaIN, AdaptiveAttention
         
     | 
| 6 | 
         
            +
            from tensorflow_addons.layers import InstanceNormalization
         
     | 
| 7 | 
         
             
            import numpy as np
         
     | 
| 8 | 
         
             
            import cv2
         
     | 
| 9 | 
         
             
            from scipy.ndimage import gaussian_filter
         
     | 
| 
         | 
|
| 31 | 
         | 
| 32 | 
         
             
            g_repo = Repository(local_dir="g_model", clone_from="felixrosberg/affa_f",
         
     | 
| 33 | 
         
             
                                private=True, use_auth_token="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")
         
     | 
| 34 | 
         
            +
            G = load_model("g_model/affa_f_demo.h5", custom_objects={"AdaIN": AdaIN,
         
     | 
| 35 | 
         
            +
                                                                     "AdaptiveAttention": AdaptiveAttention,
         
     | 
| 36 | 
         
            +
                                                                     "InstanceNormalization": InstanceNormalization})
         
     | 
| 37 | 
         | 
| 38 | 
         
             
            blend_mask_base = np.zeros(shape=(256, 256, 1))
         
     | 
| 39 | 
         
             
            blend_mask_base[100:240, 32:224] = 1
         
     |