In [1]:
import my_io
reload(my_io)
import glob
import os
import warnings
warnings.filterwarnings('ignore')
TEST_DIR = '/media/raid_arr/data/ndsb/test'
OUT_DIR = '/media/raid_arr/data/ndsb/test_final'
OUT_SHAPE = (64, 64)
In [2]:
im_files = glob.glob(os.path.join(TEST_DIR, '*.jpg'))
In [4]:
my_io.multi_extract(im_files, OUT_DIR,
backend='lmdb', perturb=False,
out_shape=OUT_SHAPE,
transfer_feats=True, transfer_lbls=False,
mode='test',
verbose=True)
In [1]:
import my_io
reload(my_io)
import glob
import os
import numpy as np
import warnings
warnings.filterwarnings('ignore')
TRAIN_FOLD_PATH = '/media/raid_arr/tmp/train0_norm_lmdb' # Output train
TEST_FOLD_PATH = '/media/raid_arr/tmp/test0_norm_lmdb' # Output test
TRAIN_FOLD_TXT = '/media/raid_arr/data/ndsb/folds/train0.txt'
TEST_FOLD_TXT = '/media/raid_arr/data/ndsb/folds/test0.txt'
OUT_SHAPE = (64, 64)
In [3]:
# Grab the image paths from the folds that were already generated
train_fold_paths = np.loadtxt(TRAIN_FOLD_TXT, delimiter='\t', dtype=str)[:, 0]
test_fold_paths = np.loadtxt(TEST_FOLD_TXT, delimiter='\t', dtype=str)[:, 0]
np.random.shuffle(train_fold_paths)
np.random.shuffle(test_fold_paths)
In [4]:
my_io.multi_extract(test_fold_paths, TEST_FOLD_PATH,
backend='lmdb', perturb=False,
out_shape=OUT_SHAPE,
transfer_feats=True, transfer_lbls=True,
mode='train',
verbose=True)
In [ ]:
my_io.multi_extract(train_fold_paths, TRAIN_FOLD_PATH,
backend='lmdb', perturb=False,
out_shape=OUT_SHAPE,
transfer_feats=True, transfer_lbls=True,
mode='train',
verbose=True)
In [44]:
import matplotlib.pyplot as plt
%matplotlib inline
imshow = lambda im: plt.imshow(im, cmap='gray', interpolation='none')
data = my_io.load_lmdb(TEST_FOLD_PATH)
In [45]:
(image_path, image, label) = zip(*data)
In [47]:
im = np.squeeze(image[10])
imshow(im)
Out[47]:
In [1]:
import my_io
reload(my_io)
import glob
import os
import numpy as np
import warnings
warnings.filterwarnings('ignore')
TRAIN_FOLD_PATH = '/media/raid_arr/tmp/train0_norm_lmdb' # Output train
TEST_FOLD_PATH = '/media/raid_arr/tmp/test0_norm_lmdb' # Output test
TRAIN_FOLD_TXT = '/media/raid_arr/data/ndsb/folds/train0.txt'
TEST_FOLD_TXT = '/media/raid_arr/data/ndsb/folds/test0.txt'
OUT_SHAPE = (64, 64)
# Grab the image paths from the folds that were already generated
train_fold_paths = np.loadtxt(TRAIN_FOLD_TXT, delimiter='\t', dtype=str)[:, 0]
test_fold_paths = np.loadtxt(TEST_FOLD_TXT, delimiter='\t', dtype=str)[:, 0]
np.random.shuffle(train_fold_paths)
np.random.shuffle(test_fold_paths)
In [5]:
my_io.multi_extract(train_fold_paths, TRAIN_FOLD_PATH,
backend='lmdb',
transfer_feats=False,
transfer_plbls=False,
transfer_splbls=False,
create_specialists=True,
perturb=True, verbose=True)
In [2]:
my_io.multi_extract(test_fold_paths, TEST_FOLD_PATH,
backend='lmdb',
transfer_feats=False,
transfer_plbls=False,
transfer_splbls=False,
create_specialists=True,
perturb=True, verbose=True)