-
Notifications
You must be signed in to change notification settings - Fork 727
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
size error #231
Comments
@sekisek If you only want to use 256x256 reid target image format for deepsort track, you can modify feature_extractor.py If you want to use 256x256 for trainning, you must modify train and test input transform: transform_train = torchvision.transforms.Compose([
torchvision.transforms.Resize((256,256)),
torchvision.transforms.RandomCrop((256, 256),padding=4),
torchvision.transforms.RandomHorizontalFlip(),
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
])
transform_test = torchvision.transforms.Compose([
torchvision.transforms.Resize((256, 256)),
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]) |
@chenke225 would you also change something here:
? |
|
hello! do you train your custom dataset by deepsort ? If yes, can you help me with a problem? I don't know how to train my own dataset by deepsort, help! |
Hi,
If I want to train and detect on 256X256
I need to replace every appearance of 64 128 in every .py in the project , correct?
when I do that, I get this error:
Epoch : 1 Traceback (most recent call last): File "D:\AI\Codnda\deep_sort_pytorch\deep_sort\deep\train.py", line 189, in <module> main() File "D:\AI\Codnda\deep_sort_pytorch\deep_sort\deep\train.py", line 181, in main train_loss, train_err = train(epoch) File "D:\AI\Codnda\deep_sort_pytorch\deep_sort\deep\train.py", line 84, in train outputs = net(inputs) File "C:\Users\baman\miniconda3\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "D:\AI\Codnda\deep_sort_pytorch\deep_sort\deep\model.py", line 94, in forward x = self.classifier(x) File "C:\Users\baman\miniconda3\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\baman\miniconda3\envs\yolov5\lib\site-packages\torch\nn\modules\container.py", line 139, in forward input = module(input) File "C:\Users\baman\miniconda3\envs\yolov5\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\baman\miniconda3\envs\yolov5\lib\site-packages\torch\nn\modules\linear.py", line 96, in forward return F.linear(input, self.weight, self.bias) File "C:\Users\baman\miniconda3\envs\yolov5\lib\site-packages\torch\nn\functional.py", line 1847, in linear return torch._C._nn.linear(input, weight, bias) RuntimeError: mat1 and mat2 shapes cannot be multiplied (32x59904 and 512x256)
I think I need to change this part on the model.py
`class Net(nn.Module):
def init(self, num_classes=751 ,reid=False):
super(Net,self).init()
# 3 128 64
self.conv = nn.Sequential(
nn.Conv2d(3,64,3,stride=1,padding=1),
nn.BatchNorm2d(64),
nn.ReLU(inplace=True),
# nn.Conv2d(32,32,3,stride=1,padding=1),
# nn.BatchNorm2d(32),
# nn.ReLU(inplace=True),
nn.MaxPool2d(3,2,padding=1),
)
# 32 64 32
self.layer1 = make_layers(64,64,2,False)
# 32 64 32
self.layer2 = make_layers(64,128,2,True)
# 64 32 16
self.layer3 = make_layers(128,256,2,True)
# 128 16 8
self.layer4 = make_layers(256,512,2,True)
# 256 8 4
self.avgpool = nn.AvgPool2d((8,4),1)
# 256 1 1
self.reid = reid
self.classifier = nn.Sequential(
nn.Linear(512, 256),
nn.BatchNorm1d(256),
nn.ReLU(inplace=True),
nn.Dropout(),
nn.Linear(256, num_classes),
)
if name == 'main':
net = Net()
x = torch.randn(4,3,256,256)
y = net(x)
import ipdb; ipdb.set_trace()
`
any idea?
The text was updated successfully, but these errors were encountered: