Commit 25c0c9c9640afd5d75af3d575c2cd81d2f5dc8ee

Authored by Chunk
1 parent 4e8ab1ef
Exists in master and in 1 other branch refactor

feat.ravel()[[i*304+j for i in range(0,304,8) for j in range(0,304,8)]] = 0

Showing 2 changed files with 3 additions and 1 deletions   Show diff stats
mdata/ILSVRC.py
@@ -294,7 +294,7 @@ class DataILSVRC(DataDumperBase): @@ -294,7 +294,7 @@ class DataILSVRC(DataDumperBase):
294 # img = cv2.imread(image, cv2.CV_LOAD_IMAGE_UNCHANGED) 294 # img = cv2.imread(image, cv2.CV_LOAD_IMAGE_UNCHANGED)
295 # h, w = img.shape[:2] 295 # h, w = img.shape[:2]
296 # if w < 300 or h < 300: 296 # if w < 300 or h < 300:
297 - # continue 297 + # continue
298 # left, upper = random.randint(0, w - 300), random.randint(0, h - 300) 298 # left, upper = random.randint(0, w - 300), random.randint(0, h - 300)
299 # img_crop = img[upper:upper + 300, left:left + 300] 299 # img_crop = img[upper:upper + 300, left:left + 300]
300 # cv2.imwrite(os.path.join(base_dir, category + '_crop_cv', name), img_crop) 300 # cv2.imwrite(os.path.join(base_dir, category + '_crop_cv', name), img_crop)
@@ -457,6 +457,7 @@ class DataILSVRC(DataDumperBase): @@ -457,6 +457,7 @@ class DataILSVRC(DataDumperBase):
457 dict_dataset[hash] = (tag, im.getCoefMatrix(channel='Y')) 457 dict_dataset[hash] = (tag, im.getCoefMatrix(channel='Y'))
458 458
459 for tag, feat in dict_dataset.values(): 459 for tag, feat in dict_dataset.values():
  460 + feat.ravel()[[i*304+j for i in range(0,304,8) for j in range(0,304,8)]] = 0
460 X.append(feat.ravel()) 461 X.append(feat.ravel())
461 Y.append(int(tag)) 462 Y.append(int(tag))
462 463
mdata/ILSVRC_S.py
@@ -520,6 +520,7 @@ class DataILSVRC_S(DataDumperBase): @@ -520,6 +520,7 @@ class DataILSVRC_S(DataDumperBase):
520 dict_dataset[hash] = (tag, im.getCoefMatrix(channel='Y')) 520 dict_dataset[hash] = (tag, im.getCoefMatrix(channel='Y'))
521 521
522 for tag, feat in dict_dataset.values(): 522 for tag, feat in dict_dataset.values():
  523 + feat.ravel()[[i*304+j for i in range(0,304,8) for j in range(0,304,8)]] = 0
523 X.append(feat.tolist()) 524 X.append(feat.tolist())
524 Y.append(int(tag)) 525 Y.append(int(tag))
525 526