示例#1
0
    def __init__(self, which_set, numOfClasses,
                 numOfExamplesPerClass, axes=('c', 0, 1, 'b')):
        self.height = 32
        self.width = 100
        self.axes = axes
        self.dtype = 'uint8'
        self.examples = []
        self.img_shape = (1, self.height, self.width)
        self.img_size = numpy.prod(self.img_shape)
        self.numOfClasses = numOfClasses
        self.numOfExamplesPerClass = numOfExamplesPerClass
        self.examplesPerClassCount = {}
        self.which_set = which_set
        if which_set == "train":
            self.fileToLoadFrom = "annotation_train.txt"
        elif which_set == "test":
            self.fileToLoadFrom = "annotation_test.txt"
        elif which_set == "valid":
            self.fileToLoadFrom = "annotation_val.txt"
        else:
            raise ValueError("Set not recognized")
        self.datapath = Config.getDatapath()
        self.preprocess = Config.doPreprocess()
        self.loadData()
        random.seed()

        view_converter = dense_design_matrix.DefaultViewConverter((self.height, self.width, 1),
                                                                   axes)


        super(MJSYNTH, self).__init__(X=numpy.cast['float32'](self.x), y=self.y, view_converter=view_converter,
                                       y_labels=self.numOfClasses)
示例#2
0
    def __init__(self,
                 which_set,
                 numOfClasses,
                 numOfExamplesPerClass,
                 axes=('c', 0, 1, 'b')):
        self.height = 32
        self.width = 100
        self.axes = axes
        self.dtype = 'uint8'
        self.examples = []
        self.img_shape = (1, self.height, self.width)
        self.img_size = numpy.prod(self.img_shape)
        self.numOfClasses = numOfClasses
        self.numOfExamplesPerClass = numOfExamplesPerClass
        self.examplesPerClassCount = {}
        self.which_set = which_set
        if which_set == "train":
            self.fileToLoadFrom = "annotation_train.txt"
        elif which_set == "test":
            self.fileToLoadFrom = "annotation_test.txt"
        elif which_set == "valid":
            self.fileToLoadFrom = "annotation_val.txt"
        else:
            raise ValueError("Set not recognized")
        self.datapath = Config.getDatapath()
        self.preprocess = Config.doPreprocess()
        self.loadData()
        random.seed()

        view_converter = dense_design_matrix.DefaultViewConverter(
            (self.height, self.width, 1), axes)

        super(MJSYNTH, self).__init__(X=numpy.cast['float32'](self.x),
                                      y=self.y,
                                      view_converter=view_converter,
                                      y_labels=self.numOfClasses)
示例#3
0
from pylearn2.config import yaml_parse
from pylearn2.datasets.mjsynth.mjsynth import MJSYNTH
from pylearn2.datasets.mjsynth.config import Config


def output_file_string(params):
    string = []
    for key in params.keys():
        string.append(key + ": " + str(params[key]))
    return ' '.join(string)


p = Parser()

while p.has_other_configurations():
    with open(Config.getYamlFilename(), 'r') as f:
        yaml_file = f.read()
    hyper_params = p.get_next_configuration()
    outputFile = open('tests/' + p.get_num_configuration().__str__(), 'w')

    sys.stdout = outputFile
    sys.stderr = outputFile

    yaml_file = yaml_file % (hyper_params)
    print yaml_file

    train = yaml_parse.load(yaml_file)

    try:
        train.main_loop()
    except Exception as e:
from pylearn2.datasets.mjsynth.mjsynth import MJSYNTH
from pylearn2.datasets.mjsynth.config import Config


def output_file_string(params):
    string = []
    for key in params.keys():
        string.append(key + ": " + str(params[key]))
    return " ".join(string)


p = Parser()


while p.has_other_configurations():
    with open(Config.getYamlFilename(), "r") as f:
        yaml_file = f.read()
    hyper_params = p.get_next_configuration()
    outputFile = open("tests/" + p.get_num_configuration().__str__(), "w")

    sys.stdout = outputFile
    sys.stderr = outputFile

    yaml_file = yaml_file % (hyper_params)
    print yaml_file

    train = yaml_parse.load(yaml_file)

    try:
        train.main_loop()
    except Exception as e: