Exemplo n.º 1
0
    def __init__(self, root):
        paths = {
            key: os.path.join(root, value)
            for key, value in PATHS.items()
        }

        DataManager.__init__(self, paths)
Exemplo n.º 2
0
    def __init__(self, njobs=4, root_dir='.', paths=COLLECTOR_PATHS):
        paths = {
            key: os.path.join(root_dir, value)
            for key, value in paths.items()
        }

        DataManager.__init__(self, paths)

        self.njobs = njobs

        self.init()
Exemplo n.º 3
0
    def __init__(self, mnist_path, write2path):
        DataManager.__init__(self, mnist_path)
        self.num_sample = len(self.validation_images)
        self.pixels = self.validation_images.shape[1]  #dimension=784
        self.writer = tf.python_io.TFRecordWriter(write2path)

        self.tfRecordData = write2path
        for index in range(self.num_sample):
            image_string = self.validation_images[index].tostring()
            tfData = tf.train.Example(features=tf.train.Features(
                feature={
                    "labels":
                    self._int64Tofeature(
                        np.argmax(self.validation_labels[index])),
                    "pixels":
                    self._int64Tofeature(self.pixels),
                    "image_raw":
                    self._byte2feature(image_string)
                }))
            self.writer.write(tfData.SerializeToString())
        self.writer.close()