Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • PaddleDetection
  • Issue
  • #640

P
PaddleDetection
  • 项目概览

PaddlePaddle / PaddleDetection
大约 2 年 前同步成功

通知 708
Star 11112
Fork 2696
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 184
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 40
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
P
PaddleDetection
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 184
    • Issue 184
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 40
    • 合并请求 40
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板
已关闭
开放中
Opened 5月 12, 2020 by saxon_zh@saxon_zhGuest

在operators.py中按照文档新增预处理数据增强算子,无法训练

Created by: AN-ZE

在operators.py新增padding算子,将图片扩展到固定尺寸中,训练不能运行,停止不动

  @register_op
  class PaddingImage(BaseOperator):
      def __init__(self, pad=1280, mean=[127.5, 127.5, 127.5]):
          super(PaddingImage, self).__init__()
          self.pad = pad
          self.mean = mean

    def __call__(self, sample, context):
        assert 'image' in sample, 'not found image data'
        im = sample['image']
        gt_bbox = sample['gt_bbox']
        gt_class = sample['gt_class']
        im_width = sample['w']
        im_height = sample['h']
        if self.pad >= 0:
            height = int(self.pad)
            width = int(self.pad)
            h_off = math.floor(np.random.uniform(0, height - im_height))
            w_off = math.floor(np.random.uniform(0, width - im_width))
            expand_bbox = [
                -w_off / im_width, -h_off / im_height,
                (width - w_off) / im_width, (height - h_off) / im_height
            ]
            expand_im = np.ones((height, width, 3))
            expand_im = np.uint8(expand_im * np.squeeze(self.mean))
            expand_im = Image.fromarray(expand_im)
            im = Image.fromarray(im)
            expand_im.paste(im, (int(w_off), int(h_off)))
            expand_im = np.asarray(expand_im)
            gt_bbox, gt_class, _ = filter_and_process(expand_bbox, gt_bbox,
                                                      gt_class)
            sample['image'] = expand_im
            sample['gt_bbox'] = gt_bbox
            sample['gt_class'] = gt_class
            sample['w'] = width
            sample['h'] = height

        return sample

图片

指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/PaddleDetection#640
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7