當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。