From 14cdfabed5bb1ac8e75f1944f31323c69df6d9d8 Mon Sep 17 00:00:00 2001 From: Jem Date: Thu, 1 Aug 2019 18:41:20 +0800 Subject: [PATCH] fix(sliding window): fix the boundary --- gnes/preprocessor/image/sliding_window.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnes/preprocessor/image/sliding_window.py b/gnes/preprocessor/image/sliding_window.py index 40635531..63cadeaf 100644 --- a/gnes/preprocessor/image/sliding_window.py +++ b/gnes/preprocessor/image/sliding_window.py @@ -98,7 +98,7 @@ def _get_slid_offset_nd(self, all_subareas: List[List[int]], index: List[List[in @staticmethod def _get_location(all_subareas: List[List[int]], center_point: List[float]) -> List[bool]: location_list = [] - x_boundary = max([x[1] for x in all_subareas]) + x_boundary = max([x[2] for x in all_subareas]) y_boundary = max([y[3] for y in all_subareas]) for area in all_subareas: if center_point[0] in range(int(area[0]), int(area[2])) and center_point[1] in range(int(area[1]), @@ -110,6 +110,8 @@ def _get_location(all_subareas: List[List[int]], center_point: List[float]) -> L location_list.append(True) else: location_list.append(False) + if True not in location_list: + location_list[-1] = True return location_list