فهرست منبع

moved uniform parts function to deprecation section

Dimitri Korsch 6 سال پیش
والد
کامیت
b5003adca6
1فایلهای تغییر یافته به همراه20 افزوده شده و 18 حذف شده
  1. 20 18
      nabirds/dataset/utils.py

+ 20 - 18
nabirds/dataset/utils.py

@@ -26,24 +26,6 @@ def asarray(im, dtype=np.uint8):
 		raise ValueError("Unknown image instance ({})!".format(type(im)))
 
 
-def uniform_parts(im, ratio=DEFAULT_RATIO, round_op=np.floor):
-	h, w, c = dimensions(im)
-
-	part_w = round_op(w * ratio).astype(np.int32)
-	part_h = round_op(h * ratio).astype(np.int32)
-
-	n, m = w // part_w, h // part_h
-
-	parts = np.ones((n*m, 4), dtype=int)
-	parts[:, 0] = np.arange(n*m)
-
-	for x in range(n):
-		for y in range(m):
-			i = y * n + x
-			x0, y0 = x * part_w, y * part_h
-			parts[i, 1:3] = [x0 + part_w // 2, y0 + part_h // 2]
-
-	return parts
 
 def select_crops(crops, mask):
 	selected = np.zeros_like(crops)
@@ -83,6 +65,26 @@ def random_idxs(idxs, rnd=None, n_parts=None):
 # def __expand_parts(p):
 # 	return p[:, 0], p[:, 1:3], p[:, 3].astype(bool)
 
+def uniform_parts(im, ratio=DEFAULT_RATIO, round_op=np.floor):
+	raise DeprecationWarning("Do not use me!")
+	# h, w, c = dimensions(im)
+
+	# part_w = round_op(w * ratio).astype(np.int32)
+	# part_h = round_op(h * ratio).astype(np.int32)
+
+	# n, m = w // part_w, h // part_h
+
+	# parts = np.ones((n*m, 4), dtype=int)
+	# parts[:, 0] = np.arange(n*m)
+
+	# for x in range(n):
+	# 	for y in range(m):
+	# 		i = y * n + x
+	# 		x0, y0 = x * part_w, y * part_h
+	# 		parts[i, 1:3] = [x0 + part_w // 2, y0 + part_h // 2]
+
+	# return parts
+
 def rescale_parts(im, parts, part_rescale_size):
 	raise DeprecationWarning("Do not use me!")
 	# if part_rescale_size is None or part_rescale_size < 0: