I just begin learning deep learning and my first homework is to finish an leaves-classification system based on convolutional neural networks.I built a resnet-34 model with the code on github to do it.However,my teacher told me that the basic training unit in his dataset is an image pair.I should use 2 images(photos of the same leaf under different light conditions) as the input,combining two 3-channel images into one 6-channel image,but I don't know how to input 2 images and combine them into 6 channels.How can I do that?Are there any functions?Should I modify the structure of the resnet network?
this is my dataset,you can see every two images are about the same leaf.
您有几个问题需要解决:
- 你需要一个Dataset with a
__getitem__
返回 2 个图像(和一个标签)的方法,而不是返回单个图像和一个标签的基本方法。你可能需要定制您自己的数据集.
- 确保应用于图像的增强以相同的方式应用于每对图像。
- 您需要修改 ResNet-34 网络以获取 2 张图像(而不是一张)作为输入。参见,例如,这个答案如何做到这一点。
- 您需要将第一个卷积层更改为具有 6 个输入通道,而不是 3 个。
- 如果您想使用预先训练的权重,您将无法加载现有的权重
state_dict
ResNet34 因为更改 #3 和 #4 - 您必须第一次手动执行此操作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)