Example #1
0
def read_split(split):

    test_fname = 'test'+str(split)+'.txt'
    
    part_dat = False
    
    
    df_test = create_df(os.path.join(datapath, test_fname),
                         img_path,
                         partial_dataset=part_dat,
                         seed=123)
    
    
    return df_test
Example #2
0
def read_split_to_dfs(split):

    train_fname = 'train' + str(split) + '.txt'
    test_fname = 'test' + str(split) + '.txt'
    val_fname = 'val' + str(split) + '.txt'

    part_dat = False

    df_train = create_df(os.path.join(datapath, train_fname),
                         img_path,
                         partial_dataset=part_dat,
                         seed=123)

    df_test = create_df(os.path.join(datapath, test_fname),
                        img_path,
                        partial_dataset=part_dat,
                        seed=123)

    df_val = create_df(os.path.join(datapath, val_fname),
                       img_path,
                       partial_dataset=part_dat,
                       seed=123)

    return df_train, df_test, df_val
Example #3
0
#Load the ready-made splits
if platform.system() == 'Linux':
    datapath = '/home/mikko/Documents/kandi/data/IDA/Separate lists with numbering/Machine learning splits'
    img_path = '/home/mikko/Documents/kandi/data/IDA/Images/'
else:
    datapath = 'C:\\koodia\\kandi\\FIN Benthic2\\IDA\\Separate lists with numbering\\Machine learning splits'
    img_path = 'C:\\koodia\\kandi\\FIN Benthic2\\IDA\\Images\\'

split = 1
test_fname = 'test'+str(split)+'.txt'

part_dat = True

df_test = create_df(os.path.join(datapath, test_fname),
                     img_path,
                     partial_dataset=part_dat,
                     seed=123)


#%% Loading in memory
import tensorflow as tf

def create_tf_img(fname, imsize):
    img = tf.io.read_file(fname)
    img = tf.image.decode_jpeg(img, channels=3)
    img = tf.image.convert_image_dtype(img, tf.float32)
    return tf.image.resize(img, imsize[0:-1])


def load_images(df, img_path, imsize=(224,224,3)):
    imglist = df.loc[:,"path"].tolist()