1.因为模型融合,所以不能使用多GPU,只能使用单GPU进行计算。可能需要继续探究吧。。。。
2.一开始直接将nn.DATAPARALLEL去掉,这样其实整个模型就只能适应cpu的训练如果你输入的数据是cuda类型的话,会报错。大概就是说模型本身不支持cuda但是你的输入数据是cuda。
3.所以使用gpu训练需要三个点:模型转化,数据转换等 https://blog.csdn.net/qq_21578849/article/details/85240797 具体如下。
4.如何制定多GPU还是单GPU训练呢。https://blog.csdn.net/gaishi_hero/article/details/81139045
BP是处理的关键,没有BP就没有学习,
def forward ()中的数值都会有 grad_fn的标志,而如果另外写一个方法,输出的数值就没有该标志,所以往里面加的卷积层都没反向传播的功能。https://www.jianshu.com/p/01440b9ef5d5 参考学习
def featuremaps(self, x):
out_feature = x.permute(0,2,3,1)
print('1hao')
print(out_feature)
ocr_feature = ocr_model(out_feature)
p