Giter Club home page Giter Club logo

Comments (4)

horngjason avatar horngjason commented on July 18, 2024

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!

from yolov3-network-slimming.

andylai0212 avatar andylai0212 commented on July 18, 2024

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?

from yolov3-network-slimming.

cococener avatar cococener commented on July 18, 2024

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.

from yolov3-network-slimming.

cococener avatar cococener commented on July 18, 2024

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?

from yolov3-network-slimming.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.