How to use the larray.lmap function in larray

To help you get started, we’ve selected a few larray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jaberg / skdata / skdata / lfw.py View on Github external
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
github jaberg / skdata / skdata / lfw.py View on Github external
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
github jaberg / skdata / skdata / caltech.py View on Github external
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
github jaberg / skdata / skdata / lfw.py View on Github external
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
github jaberg / skdata / skdata / lfw.py View on Github external
task = sys.argv[2]
        except IndexError:
            print >> sys.stderr, "Usage one of"
            print >> sys.stderr, "     lfw. people"
            print >> sys.stderr, "     lfw. pairs"
            print >> sys.stderr, "     lfw. pairs_train"
            print >> sys.stderr, "     lfw. pairs_test"
            print >> sys.stderr, "     lfw. 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()
github jaberg / skdata / skdata / pubfig83.py View on Github external
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])