Browse Source

Remove some unused part from config

Jérôme BUISINE 1 year ago
parent
commit
a313795ee6
1 changed files with 1 additions and 79 deletions
  1. 1 79
      utils/data.py

+ 1 - 79
utils/data.py

@@ -60,82 +60,4 @@ def get_scene_image_prefix(img_path):
     # if path getting last element (image name) and extract prefix
     img_prefix = img_path.split('/')[-1].split(scene_image_quality_separator)[0]
 
-    return img_prefix
-
-
-def augmented_data_image(block, output_folder, prefix_image_name):
-
-    rotations = [0, 90, 180, 270]
-    img_flip_labels = ['original', 'horizontal', 'vertical', 'both']
-
-    horizontal_img = block.transpose(Image.FLIP_LEFT_RIGHT)
-    vertical_img = block.transpose(Image.FLIP_TOP_BOTTOM)
-    both_img = block.transpose(Image.TRANSPOSE)
-
-    flip_images = [block, horizontal_img, vertical_img, both_img]
-
-    # rotate and flip image to increase dataset size
-    for id, flip in enumerate(flip_images):
-        for rotation in rotations:
-            rotated_output_img = flip.rotate(rotation)
-
-            output_reconstructed_filename = prefix_image_name + post_image_name_separator
-            output_reconstructed_filename = output_reconstructed_filename + img_flip_labels[id] + '_' + str(rotation) + '.png'
-            output_reconstructed_path = os.path.join(output_folder, output_reconstructed_filename)
-
-            if not os.path.exists(output_reconstructed_path):
-                rotated_output_img.save(output_reconstructed_path)
-
-
-def remove_pixel(img, limit):
-    
-    width, height = img.shape
-    
-    output = np.zeros((width, height))
-    
-    for i in range(width):
-        for j in range(height):
-            
-            if img[i,j] <= limit:
-                output[i,j] = img[i,j]
-                
-    return output
-
-
-def get_random_value(distribution):
-    rand = random.uniform(0, 1)
-    prob_sum = 0.
-    
-    for id, prob in enumerate(distribution):
-        
-        prob_sum += prob
-        
-        if prob_sum >= rand:
-            return id
-        
-    return len(distribution) - 1
-
-
-def distribution_from_data(data):
-    
-    occurences = np.array([data.count(x) for x in set(data)])
-    max_occurences = sum(occurences)
-    
-    return occurences / max_occurences
-
-
-def fill_image_with_rand_value(img, func, value_to_replace):
-    
-    width, height = img.shape
-    
-    output = np.zeros((width, height))
-    
-    for i in range(width):
-        for j in range(height):
-            
-            if img[i,j] == value_to_replace:
-                output[i, j] = func()
-            else:
-                output[i, j] = img[i, j]
-                
-    return output
+    return img_prefix