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

Can this code runs yolov3-tiny? #8

Closed
horngjason opened this issue Jan 16, 2019 · 4 comments
Closed

Can this code runs yolov3-tiny? #8

horngjason opened this issue Jan 16, 2019 · 4 comments

Comments

@horngjason
Copy link

Hi @talevolano,

For yolov3.cfg, it works. Yet I can make yolov3-tiny work with this code by simply change the cmd to point to yolov3.cfg as well as yolov3.weights. I would like to inquire whether or not this implementation can access yolov3-tiny.cfg with yolov3-tiny.weights? Thanks.

@horngjason
Copy link
Author

horngjason commented Jan 17, 2019

After reference searching and discussion, we found this code can work with yolov3-tiny.cfg by a simple modification in yolomodel.py. This modification won't effect the process of yolov3.cfg.

Please refer to https://github.com/ultralytics/yolov3/issues/51 what the modification in model.py that glenn-jocher reported.

In here, we simply substitute line #284 in yolomodel.py ( in create_modules() ):
pool = nn.MaxPool2d(stride=stride,kernel_size=kernel_size)
as following codes
if kernel_size == 2 and stride == 1:
module.add_module('debug_padding%d' % index, nn.ZeroPad2d((0, 1, 0, 1)))
pool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=int((kernel_size - 1) // 2))

by referring to the glenn-jocher's method in model.py.

*ps:
We also tried
pool = nn.MaxPool2d(stride=stride,kernel_size=kernel_size, ceil_mode=True)
Yet this didn't work.

If anyone has any better idea, please do make us know. Thanks a lot!

@andylai0212
Copy link

Hi @horngjason, when I try to run with yolov3-tiny, it has error:
Traceback (most recent call last):
File "sparsity_train.py", line 154, in
train()
File "sparsity_train.py", line 100, in train
loss = model(imgs, targets)
File "/home/andy0212/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/andy0212/Documents/yolov3-network-slimming/yolomodel.py", line 332, in forward
x = torch.cat((map1, map2), 1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 26 and 24 in dimension 2 at /opt/conda/conda-bld/pytorch_1549635019666/work/aten/src/THC/generic/THCTensorMath.cu:83

Did you encounter the same problem?

@cococener
Copy link

After reference searching and discussion, we found this code can work with yolov3-tiny.cfg by a simple modification in yolomodel.py. This modification won't effect the process of yolov3.cfg.

Please refer to https://github.com/ultralytics/yolov3/issues/51 what the modification in model.py that glenn-jocher reported.

In here, we simply substitute line #284 in yolomodel.py ( in create_modules() ):
pool = nn.MaxPool2d(stride=stride,kernel_size=kernel_size)
as following codes
if kernel_size == 2 and stride == 1: module.add_module('debug_padding%d' % index, nn.ZeroPad2d((0, 1, 0, 1))) pool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=int((kernel_size - 1) // 2))
by referring to the glenn-jocher's method in model.py.

*ps:
We also tried
pool = nn.MaxPool2d(stride=stride,kernel_size=kernel_size, ceil_mode=True)
Yet this didn't work.

If anyone has any better idea, please do make us know. Thanks a lot!

But I use this it reminds me out of memory,Before I use it I encounter RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1.

@cococener
Copy link

Hi @horngjason, when I try to run with yolov3-tiny, it has error:
Traceback (most recent call last):
File "sparsity_train.py", line 154, in
train()
File "sparsity_train.py", line 100, in train
loss = model(imgs, targets)
File "/home/andy0212/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/andy0212/Documents/yolov3-network-slimming/yolomodel.py", line 332, in forward
x = torch.cat((map1, map2), 1)
RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 1. Got 26 and 24 in dimension 2 at /opt/conda/conda-bld/pytorch_1549635019666/work/aten/src/THC/generic/THCTensorMath.cu:83

Did you encounter the same problem?

So did you solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants