<commit_before>import cv2, numpy as np
import time
import math as mth
from PIL import Image, ImageDraw, ImageFont
import scipy.io
from keras.models import Sequential
from keras import initializations
from keras.initializations import normal, identity
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.optimizers import RMSprop, SGD, Adam
import random
import argparse
from scipy import ndimage
from keras.preprocessing import image
from sklearn.preprocessing import OneHotEncoder
from features import get_image_descriptor_for_image, obtain_compiled_vgg_16, vgg_16, \
    get_conv_image_descriptor_for_image, calculate_all_initial_feature_maps
from parse_xml_annotations import *
from image_helper import *
from metrics import *
from visualization import *
from reinforcement import *


# Read number of epoch to be trained, to make checkpointing
parser = argparse.ArgumentParser(description='Epoch:')
parser.add_argument("-n", metavar='N', type=int, default=0)
args = parser.parse_args()
epochs_id = int(args.n)


if __name__ == "__main__":

    ######## PATHS definition ########

    # path of PASCAL VOC 2012 or other database to use for training
    path_voc = "./VOC2012/"
    # path of other PASCAL VOC dataset, if you want to train with 2007 and 2012 train datasets
    path_voc2 = "./VOC2007/"
    # path of where to store the models
    path_model = "../models_image_zooms"
    # path of where to store visualizations of search sequences
    path_testing_folder = '../testing_visualizations'
    # path of VGG16 weights
    path_vgg = "../vgg16_weights.h5"

    ######## PARAMETERS ########

    # Class category of PASCAL that the RL agent will be searching
    class_object = 1
    # Scale of subregion for the hierarchical regions (in quarters, to deal with 1/4, 2/4, 3/4)
    scale_subregion = float(3)/4
    scale_mask = float(1)/(scale_subregion*4)
    # 1 if you want to obtain visualizations of the search for objects
    bool_draw = 0
    # How many steps can run the agent until finding one object
    number_of_steps = 10
    # Boolean to indicate if you want to use the two databases, or just one
    two_databases = 0
    epochs = 50
    gamma = 0.90
    epsilon = 1
    batch_size = 100
    # Pointer to where to store the last experience in the experience replay buffer,
    # actually there is a pointer for each PASCAL category, in case all categories
    # are trained at the same time
    h = np.zeros([20])
    # Each replay memory (one for each possible category) has a capacity of 100 experiences
    buffer_experience_replay = 1000<commit_msg>Update image_zooms_training.py<commit_after>import cv2, numpy as np
import time
import math as mth
from PIL import Image, ImageDraw, ImageFont
import scipy.io
from keras.models import Sequential
from keras import initializations
from keras.initializations import normal, identity
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.optimizers import RMSprop, SGD, Adam
import random
import argparse
from scipy import ndimage
from keras.preprocessing import image
from sklearn.preprocessing import OneHotEncoder
from features import get_image_descriptor_for_image, obtain_compiled_vgg_16, vgg_16, \
    get_conv_image_descriptor_for_image, calculate_all_initial_feature_maps
from parse_xml_annotations import *
from image_helper import *
from metrics import *
from visualization import *
from reinforcement import *


# Read number of epoch to be trained, to make checkpointing
parser = argparse.ArgumentParser(description='Epoch:')
parser.add_argument("-n", metavar='N', type=int, default=0)
args = parser.parse_args()
epochs_id = int(args.n)


if __name__ == "__main__":

    ######## PATHS definition ########

    # path of PASCAL VOC 2012 or other database to use for training
    path_voc = "./VOC2012/"
    # path of other PASCAL VOC dataset, if you want to train with 2007 and 2012 train datasets
    path_voc2 = "./VOC2007/"
    # path of where to store the models
    path_model = "../models_image_zooms"
    # path of where to store visualizations of search sequences
    path_testing_folder = '../testing_visualizations'
    # path of VGG16 weights
    path_vgg = "../vgg16_weights.h5"

    ######## PARAMETERS ########

    # Class category of PASCAL that the RL agent will be searching
    class_object = 1
    # Scale of subregion for the hierarchical regions (to deal with 2/4, 3/4)
    scale_subregion = float(3)/4
    scale_mask = float(1)/(scale_subregion*4)
    # 1 if you want to obtain visualizations of the search for objects
    bool_draw = 0
    # How many steps can run the agent until finding one object
    number_of_steps = 10
    # Boolean to indicate if you want to use the two databases, or just one
    two_databases = 0
    epochs = 50
    gamma = 0.90
    epsilon = 1
    batch_size = 100
    # Pointer to where to store the last experience in the experience replay buffer,
    # actually there is a pointer for each PASCAL category, in case all categories
    # are trained at the same time
    h = np.zeros([20])
    # Each replay memory (one for each possible category) has a capacity of 100 experiences
    buffer_experience_replay = 1000
{'fraction_non_alphanumeric': 0.07072842590812993, 'fraction_numerical': 0.024985585239285027, 'mean_word_length': 3.9327014218009477, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4099483', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1475, 'n_words': 601}