记录一下自己跑深度学习时犯得一个基础的错误:
错误代码:
......
backbone = 'resnet50'
if 'resnet18' or 'resnet34' in backbone:
......
这种情况下if必执行。正确写法应该加个括号
......
backbone = 'resnet50'
if ('resnet18' or 'resnet34') in backbone:
......
演示两种判断语句输出结果:
>>> 'resnet18' or 'resnet38' in backbone
'resnet18'>>> bool('resnet18')
True>>> ('resnet18' or 'resnet38') in backbone
False
以此博客让自己不要忘记这种基础性错误。。。羞耻。