Ejemplo n.º 1
0
 def img_verification_task(self, split='DevTrain', dtype='uint8'):
     lpaths, rpaths, labels = self.raw_verification_task(split)
     limgs = larray.lmap(
         utils.image.ImgLoader(shape=(250, 250, 3), dtype=dtype), lpaths)
     rimgs = larray.lmap(
         utils.image.ImgLoader(shape=(250, 250, 3), dtype=dtype), rpaths)
     return limgs, rimgs, labels
Ejemplo n.º 2
0
    def img_verification_task(self, split=None, dtype='uint8',
                              resplit=None, seed=0):

        """
            use resplit to generate a resplitting of the view data
            e.g. resplit='train_0' to get the training portion of the 0th split
            seed initializes random number generator for resplitting
            generation. default seed=0 generates standard "canonical" splits.
        """
        assert resplit is None or split is None

        if resplit is not None:
            lpaths, rpaths, labels = self.raw_verification_task_resplit(resplit,
                                                                     seed=seed)
        else:
            if split is None:
                split = 'DevTrain'
            lpaths, rpaths, labels = self.raw_verification_task(split)
        limgs = larray.lmap(
                utils.image.ImgLoader(shape=self.img_shape, dtype=dtype),
                lpaths)
        rimgs = larray.lmap(
                utils.image.ImgLoader(shape=self.img_shape, dtype=dtype),
                rpaths)
        return limgs, rimgs, labels
Ejemplo n.º 3
0
 def img_verification_task_from_raw(self, lpaths, rpaths, labels,
         dtype='uint8'):
     limgs = larray.lmap(
             utils.image.ImgLoader(shape=self.img_shape, dtype=dtype),
             lpaths)
     rimgs = larray.lmap(
             utils.image.ImgLoader(shape=self.img_shape, dtype=dtype),
             rpaths)
     return limgs, rimgs, labels
Ejemplo n.º 4
0
 def img_verification_task(self, split='DevTrain', dtype='uint8'):
     lpaths, rpaths, labels = self.raw_verification_task(split)
     limgs = larray.lmap(
             utils.image.ImgLoader(shape=(250, 250, 3), dtype=dtype),
             lpaths)
     rimgs = larray.lmap(
             utils.image.ImgLoader(shape=(250, 250, 3), dtype=dtype),
             rpaths)
     return limgs, rimgs, labels
Ejemplo n.º 5
0
    def main_show(cls):
        # Usage one of:
        # <driver> people
        # <driver> pairs
        from utils.glviewer import glumpy_viewer, command, glumpy
        import larray

        # print 'ARGV', sys.argv
        try:
            task = sys.argv[2]
        except IndexError:
            print >> sys.stderr, "Usage one of"
            print >> sys.stderr, "    <driver> lfw.<imgset> people"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_train"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_test"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_10folds"
            return 1

        if task == "people":
            self = cls()
            image_paths = [self.image_path(m) for m in self.meta]
            names = np.asarray([m["name"] for m in self.meta])
            glumpy_viewer(img_array=larray.lmap(utils.image.load_rgb_f32, image_paths), arrays_to_print=[names])
        elif task == "pairs" or sys.argv[2] == "pairs_train":
            raise NotImplementedError()
        elif task == "pairs_test":
            raise NotImplementedError()
        elif task == "pairs_10folds":
            fold_num = int(sys.argv[3])
            raise NotImplementedError()
        if 0:
            left_imgs = img_load(lpaths, slice_, color, resize)
            right_imgs = img_load(rpaths, slice_, color, resize)
            pairs = larray.lzip(left_imgs, right_imgs)
Ejemplo n.º 6
0
    def main_show(cls):
        # Usage one of:
        # <driver> people
        # <driver> pairs
        from utils.glviewer import glumpy_viewer
        try:
            task = sys.argv[2]
        except IndexError:
            print >> sys.stderr, "Usage one of"
            print >> sys.stderr, "    <driver> lfw.<imgset> people"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_train"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_test"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_10folds"
            return 1

        if task == 'people':
            self = cls()
            image_paths = [self.image_path(m) for m in self.meta]
            names = np.asarray([m['name'] for m in self.meta])
            glumpy_viewer(
                    img_array=larray.lmap(
                        utils.image.load_rgb_f32,
                        image_paths),
                    arrays_to_print=[names])
        elif task == 'pairs' or sys.argv[2] == 'pairs_train':
            raise NotImplementedError()
        elif task == 'pairs_test':
            raise NotImplementedError()
        elif task == 'pairs_10folds':
            raise NotImplementedError()
Ejemplo n.º 7
0
 def img_classification_task(self, dtype='uint8', split=None):
     img_paths, labels, inds = self.raw_classification_task(split=split)
     imgs = larray.lmap(ImgLoader(shape=(100, 100, 3),
                                  dtype=dtype,
                                  mode='RGB'),
                        img_paths)
     return imgs, labels
Ejemplo n.º 8
0
    def main_show(cls):
        # Usage one of:
        # <driver> people
        # <driver> pairs
        from utils.glviewer import glumpy_viewer
        try:
            task = sys.argv[2]
        except IndexError:
            print >> sys.stderr, "Usage one of"
            print >> sys.stderr, "    <driver> lfw.<imgset> people"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_train"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_test"
            print >> sys.stderr, "    <driver> lfw.<imgset> pairs_10folds"
            return 1

        if task == 'people':
            self = cls()
            image_paths = [self.image_path(m) for m in self.meta]
            names = np.asarray([m['name'] for m in self.meta])
            glumpy_viewer(img_array=larray.lmap(utils.image.load_rgb_f32,
                                                image_paths),
                          arrays_to_print=[names])
        elif task == 'pairs' or sys.argv[2] == 'pairs_train':
            raise NotImplementedError()
        elif task == 'pairs_test':
            raise NotImplementedError()
        elif task == 'pairs_10folds':
            raise NotImplementedError()
Ejemplo n.º 9
0
def main_show():
    """compatibility with bin/datasets-show"""
    from utils.glviewer import glumpy_viewer
    import larray
    pf = PubFig83()
    names = [m['name'] for m in pf.meta]
    paths = [pf.image_path(m) for m in pf.meta]
    glumpy_viewer(img_array=larray.lmap(utils.image.ImgLoader(), paths),
                  arrays_to_print=[names])
Ejemplo n.º 10
0
def main_show():
    """compatibility with bin/datasets-show"""
    from utils.glviewer import glumpy_viewer
    import larray
    pf = PubFig83()
    names = [m['name'] for m in pf.meta]
    paths = [pf.image_path(m) for m in pf.meta]
    glumpy_viewer(
            img_array=larray.lmap(utils.image.ImgLoader(), paths),
            arrays_to_print=[names])
Ejemplo n.º 11
0
 def img_recognition_task(self, dtype="uint8"):
     img_paths, labels = self.raw_recognition_task()
     imgs = larray.lmap(utils.image.ImgLoader(shape=(250, 250, 3), dtype=dtype), img_paths)
     return imgs, labels
Ejemplo n.º 12
0
 def img_classification_task(self, dtype="uint8", split=None):
     img_paths, labels = self.raw_classification_task(split=split)
     imgs = larray.lmap(ImgLoader(ndim=2, shape=(400, 400), dtype=dtype, mode="L"), img_paths)
     return imgs, labels
Ejemplo n.º 13
0
 def img_classification_task(self, dtype='uint8', split=None):
     img_paths, labels = self.raw_classification_task(split=split)
     imgs = larray.lmap(ImgLoader(ndim=3, dtype=dtype, mode='RGB'),
                        img_paths)
     return imgs, labels
Ejemplo n.º 14
0
 def img_classification_task(self, dtype='uint8'):
     img_paths, labels = self.raw_classification_task()
     imgs = larray.lmap(
             utils.image.ImgLoader(shape=self.img_shape, dtype=dtype),
             img_paths)
     return imgs, labels
Ejemplo n.º 15
0
 def img_recognition_task(self, dtype='uint8'):
     img_paths, labels = self.raw_recognition_task()
     imgs = larray.lmap(
         utils.image.ImgLoader(shape=(250, 250, 3), dtype=dtype), img_paths)
     return imgs, labels