import matplotlib.pyplot as plt

from train_config import train_images, val_images, test_images, train_gt, val_gt
from train_config import num_classes, train_batch_size, val_batch_size
from train_config import vgg_pretrained, epochs

# Put the paths to the datasets in lists, because that's what `BatchGenerator` requires as input.
train_image_dirs = [train_images]
train_ground_truth_dirs = [train_gt]
val_image_dirs = [val_images]
val_ground_truth_dirs = [val_gt]

train_dataset = BatchGenerator(image_dirs=train_image_dirs,
                               image_file_extension='png',
                               ground_truth_dirs=train_ground_truth_dirs,
                               image_name_split_separator='leftImg8bit',
                               ground_truth_suffix='gtFine_labelIds',
                               check_existence=True,
                               num_classes=num_classes)

val_dataset = BatchGenerator(image_dirs=val_image_dirs,
                             image_file_extension='png',
                             ground_truth_dirs=val_ground_truth_dirs,
                             image_name_split_separator='leftImg8bit',
                             ground_truth_suffix='gtFine_labelIds',
                             check_existence=True,
                             num_classes=num_classes)

num_train_images = train_dataset.get_num_files()
num_val_images = val_dataset.get_num_files()
Exemple #2
0
df = pd.read_csv('dataset/csv/imdb_csv/imdb_age_regression_train_split_47950-70-10-20.csv')


# In[5]:


cols = list(df.columns[1:])
in_format = list(df.columns)
cols, in_format


# In[6]:


train_dataset = BatchGenerator(box_output_format=cols)
validation_dataset = BatchGenerator(box_output_format=cols)

train_dataset. parse_csv(labels_filename='dataset/csv/imdb_csv/imdb_age_regression_train_split_47950-70-10-20.csv', 
                        images_dir='dataset/imdb-hand-crop',
                        input_format=in_format)

validation_dataset.parse_csv(labels_filename='dataset/csv/imdb_csv/imdb_age_regression_val_split_47950-70-10-20.csv', 
                             images_dir='dataset/imdb-hand-crop',
                             input_format=in_format)


# In[7]:


img_height, img_width, img_depth = (224,224,3)
Exemple #3
0
# ### ATENÇÃO: SELECIONAR OS PATHS PROS PESOS

# In[2]:

activations = ['relu', 'lrelu']
img_treats = ['image-treat-1', 'image-treat-2', 'image-treat-3']
nets = ['lenet', 'alexnet']

for img_treat in img_treats:
    for net in nets:
        for activation in activations:

            # In[3]:

            test_dataset = BatchGenerator(box_output_format=['class_id'])
            test_dataset.parse_csv(
                labels_filename=
                '/home/nicoli/github/alexnet/dataset/csv/imdb_csv/imdb_age_regression_test_split_47950-70-10-20.csv',
                images_dir=
                '/home/nicoli/github/alexnet/dataset/imdb-hand-crop/',
                input_format=['image_name', 'class_id'])

            # In[4]:

            print("Number of images in the dataset:",
                  test_dataset.get_n_samples())

            # In[5]:

            img_height, img_width, img_depth = (224, 224, 3)