From 25c0c9c9640afd5d75af3d575c2cd81d2f5dc8ee Mon Sep 17 00:00:00 2001 From: Chunk Date: Tue, 21 Apr 2015 21:57:16 +0800 Subject: [PATCH] feat.ravel()[[i*304+j for i in range(0,304,8) for j in range(0,304,8)]] = 0 --- mdata/ILSVRC.py | 3 ++- mdata/ILSVRC_S.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mdata/ILSVRC.py b/mdata/ILSVRC.py index aefd55f..2146568 100644 --- a/mdata/ILSVRC.py +++ b/mdata/ILSVRC.py @@ -294,7 +294,7 @@ class DataILSVRC(DataDumperBase): # img = cv2.imread(image, cv2.CV_LOAD_IMAGE_UNCHANGED) # h, w = img.shape[:2] # if w < 300 or h < 300: - # continue + # continue # left, upper = random.randint(0, w - 300), random.randint(0, h - 300) # img_crop = img[upper:upper + 300, left:left + 300] # cv2.imwrite(os.path.join(base_dir, category + '_crop_cv', name), img_crop) @@ -457,6 +457,7 @@ class DataILSVRC(DataDumperBase): dict_dataset[hash] = (tag, im.getCoefMatrix(channel='Y')) for tag, feat in dict_dataset.values(): + feat.ravel()[[i*304+j for i in range(0,304,8) for j in range(0,304,8)]] = 0 X.append(feat.ravel()) Y.append(int(tag)) diff --git a/mdata/ILSVRC_S.py b/mdata/ILSVRC_S.py index 77da0da..edf4469 100644 --- a/mdata/ILSVRC_S.py +++ b/mdata/ILSVRC_S.py @@ -520,6 +520,7 @@ class DataILSVRC_S(DataDumperBase): dict_dataset[hash] = (tag, im.getCoefMatrix(channel='Y')) for tag, feat in dict_dataset.values(): + feat.ravel()[[i*304+j for i in range(0,304,8) for j in range(0,304,8)]] = 0 X.append(feat.tolist()) Y.append(int(tag)) -- libgit2 0.21.2