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

关于hubconf.py中process_image的疑问 #1057

Open
4 tasks done
clhne opened this issue Jul 1, 2024 · 0 comments
Open
4 tasks done

关于hubconf.py中process_image的疑问 #1057

clhne opened this issue Jul 1, 2024 · 0 comments
Labels
question Further information is requested

Comments

@clhne
Copy link

clhne commented Jul 1, 2024

Before Asking

  • I have read the README carefully. 我已经仔细阅读了README上的操作指引。

  • I want to train my custom dataset, and I have read the tutorials for training your custom data carefully and organize my dataset correctly; (FYI: We recommand you to apply the config files of xx_finetune.py.) 我想训练自定义数据集,我已经仔细阅读了训练自定义数据的教程,以及按照正确的目录结构存放数据集。(FYI: 我们推荐使用xx_finetune.py等配置文件训练自定义数据集。)

  • I have pulled the latest code of main branch to run again and the problem still existed. 我已经拉取了主分支上最新的代码,重新运行之后,问题仍不能解决。

Search before asking

  • I have searched the YOLOv6 issues and found no similar questions.

Question

请问下process_image中从opencv imread后,图像的格式默认就是BGR的,为什么又做了一次RGB2BGR的格式转换?
https://github.com/meituan/YOLOv6/blob/main/hubconf.py#L76

def process_image(path, img_size, stride):
    '''Preprocess image before inference.'''
    try:
            img_src = cv2.imread(path)                           # opencv imread读进来不就是BGR格式的吗
            img_src = cv2.cvtColor(img_src, cv2.COLOR_RGB2BGR)   # 为啥这里又做了一次RGB2BGR的转换???
            assert img_src is not None, f"opencv cannot read image correctly or {path} not exists"
    except:
            img_src = np.asarray(Image.open(path))
            assert img_src is not None, f"Image Not Found {path}, workdir: {os.getcwd()}"

Additional

No response

@clhne clhne added the question Further information is requested label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant