当前位置: 首页>>代码示例>>Python>>正文


Python common.MapData方法代码示例

本文整理汇总了Python中tensorpack.dataflow.common.MapData方法的典型用法代码示例。如果您正苦于以下问题:Python common.MapData方法的具体用法?Python common.MapData怎么用?Python common.MapData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorpack.dataflow.common的用法示例。


在下文中一共展示了common.MapData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_dataflow

# 需要导入模块: from tensorpack.dataflow import common [as 别名]
# 或者: from tensorpack.dataflow.common import MapData [as 别名]
def get_dataflow(path, is_train, img_path=None):
    ds = CocoPose(path, img_path, is_train)       # read data from lmdb
    if is_train:
        ds = MapData(ds, read_image_url)
        ds = MapDataComponent(ds, pose_random_scale)
        ds = MapDataComponent(ds, pose_rotation)
        ds = MapDataComponent(ds, pose_flip)
        ds = MapDataComponent(ds, pose_resize_shortestedge_random)
        ds = MapDataComponent(ds, pose_crop_random)
        ds = MapData(ds, pose_to_img)
        # augs = [
        #     imgaug.RandomApplyAug(imgaug.RandomChooseAug([
        #         imgaug.GaussianBlur(max_size=3)
        #     ]), 0.7)
        # ]
        # ds = AugmentImageComponent(ds, augs)
        ds = PrefetchData(ds, 1000, multiprocessing.cpu_count() * 4)
    else:
        ds = MultiThreadMapData(ds, nr_thread=16, map_func=read_image_url, buffer_size=1000)
        ds = MapDataComponent(ds, pose_resize_shortestedge_fixed)
        ds = MapDataComponent(ds, pose_crop_center)
        ds = MapData(ds, pose_to_img)
        ds = PrefetchData(ds, 100, multiprocessing.cpu_count() // 4)

    return ds 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:27,代码来源:pose_dataset.py

示例2: sample_augmentations

# 需要导入模块: from tensorpack.dataflow import common [as 别名]
# 或者: from tensorpack.dataflow.common import MapData [as 别名]
def sample_augmentations():
    ds = CocoPose('/data/public/rw/coco-pose-estimation-lmdb/', is_train=False, only_idx=0)
    ds = MapDataComponent(ds, pose_random_scale)
    ds = MapDataComponent(ds, pose_rotation)
    ds = MapDataComponent(ds, pose_flip)
    ds = MapDataComponent(ds, pose_resize_shortestedge_random)
    ds = MapDataComponent(ds, pose_crop_random)
    ds = MapData(ds, pose_to_img)
    augs = [
        imgaug.RandomApplyAug(imgaug.RandomChooseAug([
            imgaug.GaussianBlur(3),
            imgaug.SaltPepperNoise(white_prob=0.01, black_prob=0.01),
            imgaug.RandomOrderAug([
                imgaug.BrightnessScale((0.8, 1.2), clip=False),
                imgaug.Contrast((0.8, 1.2), clip=False),
                # imgaug.Saturation(0.4, rgb=True),
            ]),
        ]), 0.7),
    ]
    ds = AugmentImageComponent(ds, augs)

    ds.reset_state()
    for l1, l2, l3 in ds.get_data():
        CocoPose.display_image(l1, l2, l3) 
开发者ID:SrikanthVelpuri,项目名称:tf-pose,代码行数:26,代码来源:pose_stats.py

示例3: get_dataflow

# 需要导入模块: from tensorpack.dataflow import common [as 别名]
# 或者: from tensorpack.dataflow.common import MapData [as 别名]
def get_dataflow(path, is_train, img_path=None):
    ds = CocoPose(path, img_path, is_train)       # read data from lmdb
    if is_train:
        ds = MapData(ds, read_image_url)
        ds = MapDataComponent(ds, pose_random_scale)
        ds = MapDataComponent(ds, pose_rotation)
        ds = MapDataComponent(ds, pose_flip)
        ds = MapDataComponent(ds, pose_resize_shortestedge_random)
        ds = MapDataComponent(ds, pose_crop_random)
        ds = MapData(ds, pose_to_img)
        # augs = [
        #     imgaug.RandomApplyAug(imgaug.RandomChooseAug([
        #         imgaug.GaussianBlur(max_size=3)
        #     ]), 0.7)
        # ]
        # ds = AugmentImageComponent(ds, augs)
        ds = PrefetchData(ds, 1000, multiprocessing.cpu_count() * 1)
    else:
        ds = MultiThreadMapData(ds, nr_thread=16, map_func=read_image_url, buffer_size=1000)
        ds = MapDataComponent(ds, pose_resize_shortestedge_fixed)
        ds = MapDataComponent(ds, pose_crop_center)
        ds = MapData(ds, pose_to_img)
        ds = PrefetchData(ds, 100, multiprocessing.cpu_count() // 4)

    return ds 
开发者ID:PINTO0309,项目名称:MobileNetV2-PoseEstimation,代码行数:27,代码来源:pose_dataset.py

示例4: get_dataflow

# 需要导入模块: from tensorpack.dataflow import common [as 别名]
# 或者: from tensorpack.dataflow.common import MapData [as 别名]
def get_dataflow(self, cfg):

        df = Pose(cfg)
        df = MapData(df, self.augment)
        df = MapData(df, self.compute_target_part_scoremap)

        num_cores = multiprocessing.cpu_count()
        num_processes = int(num_cores * self.cfg["processratio"])
        if num_processes <= 1:
            num_processes = 2  # recommended to use more than one process for training
        if os.name == "nt":
            df2 = MultiProcessRunner(
                df, num_proc=num_processes, num_prefetch=self.cfg["num_prefetch"]
            )
        else:
            df2 = MultiProcessRunnerZMQ(
                df, num_proc=num_processes, hwm=self.cfg["num_prefetch"]
            )
        return df2 
开发者ID:DeepLabCut,项目名称:DeepLabCut,代码行数:21,代码来源:pose_dataset_tensorpack.py

示例5: get_dataflow

# 需要导入模块: from tensorpack.dataflow import common [as 别名]
# 或者: from tensorpack.dataflow.common import MapData [as 别名]
def get_dataflow(path, is_train, img_path=None):
    ds = CocoPose(path, img_path, is_train)       # read data from lmdb
    if is_train:
        ds = MapData(ds, read_image_url)
        ds = MapDataComponent(ds, pose_random_scale)
        ds = MapDataComponent(ds, pose_rotation)
        ds = MapDataComponent(ds, pose_flip)
        ds = MapDataComponent(ds, pose_resize_shortestedge_random)
        ds = MapDataComponent(ds, pose_crop_random)
        ds = MapData(ds, pose_to_img)
        # augs = [
        #     imgaug.RandomApplyAug(imgaug.RandomChooseAug([
        #         imgaug.GaussianBlur(max_size=3)
        #     ]), 0.7)
        # ]
        # ds = AugmentImageComponent(ds, augs)
        ds = PrefetchData(ds, 1000, multiprocessing.cpu_count()-1)
    else:
        ds = MultiThreadMapData(ds, nr_thread=16, map_func=read_image_url, buffer_size=1000)
        ds = MapDataComponent(ds, pose_resize_shortestedge_fixed)
        ds = MapDataComponent(ds, pose_crop_center)
        ds = MapData(ds, pose_to_img)
        ds = PrefetchData(ds, 100, multiprocessing.cpu_count() // 4)

    return ds 
开发者ID:lyk19940625,项目名称:WorkControl,代码行数:27,代码来源:pose_dataset.py

示例6: _get_dataflow_onlyread

# 需要导入模块: from tensorpack.dataflow import common [as 别名]
# 或者: from tensorpack.dataflow.common import MapData [as 别名]
def _get_dataflow_onlyread(path, is_train, img_path=None):
    ds = CocoPose(path, img_path, is_train)  # read data from lmdb
    ds = MapData(ds, read_image_url)
    ds = MapData(ds, pose_to_img)
    # ds = PrefetchData(ds, 1000, multiprocessing.cpu_count() * 4)
    return ds 
开发者ID:PINTO0309,项目名称:MobileNetV2-PoseEstimation,代码行数:8,代码来源:pose_dataset.py


注:本文中的tensorpack.dataflow.common.MapData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。