Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图像翻转导致无法启动训练 tensorflow.python.framework.errors_impl.InvalidArgumentError #3

Open
CMangoDH opened this issue Sep 5, 2020 · 1 comment

Comments

@CMangoDH
Copy link

CMangoDH commented Sep 5, 2020

图像翻转后导致xml中xmin比xmax大,这样在加载tfrecord时会断言错误,由于水平有限具体错误无法从异常链中读出来,后来逐张图的试验发现是翻转导致的问题,在作者csdn下也有人提出同样的问题,参看
我的问题是在labelImg中出现的,labelMe的并没有查看 贴下我的解决方法:
函数:_filp_pic_bboxes 修改部分代码,注释的是原代码

        flip_bboxes = list()
        for box in bboxes:
            x_min = box[0]
            y_min = box[1]
            x_max = box[2]
            y_max = box[3]
            if inver == 0:
                #flip_bboxes.append([x_max, h - y_min, x_min, h - y_max])
                flip_bboxes.append([x_min, h - y_max, x_max, h - y_min])
            elif inver == 1:
                flip_bboxes.append([w - x_max, y_min, w - x_min, y_max])                
            elif inver == -1:
                #flip_bboxes.append([w - x_min, h - y_max, w - x_max, h - y_min])
                flip_bboxes.append([w - x_max, h - y_max, w - x_min, h - y_min])
        return flip_img, flip_bboxes

最后,感谢一下作者提供的代码,帮了我很多

@yaohaizeng
Copy link

多谢兄弟,你也帮了我很多

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants