Comments (7)
Did you restart the kernel?
I tested with the following change on a GPU machine and it works:
if torch.cuda.is_available():
torch.set_default_tensor_type('torch.cuda.FloatTensor')
net = build_ssd('test', 300, 21) # initialize SSD
net.load_weights('../weights/ssd300_mAP_77.43_v2.pth')
if torch.cuda.is_available():
net = net.cuda()
from ssd.pytorch.
Most likely that the net is not on GPU, try adding the following, just after weight loading:
if torch.cuda.is_available():
net = net.cuda()
from ssd.pytorch.
I tried this way, another error occurred:
TypeError: mul received an invalid combination of arguments - got (torch.FloatTensor), but expected one of:
- (float value)
didn't match because some of the arguments have invalid types: (torch.FloatTensor) - (torch.cuda.FloatTensor other)
didn't match because some of the arguments have invalid types: (torch.FloatTensor)
I added the 'net = net.cuda()' after 'net.load_state_dict(torch.load(trained_model))' , and 'x = x.cuda()' after 'x = Variable(x.unsqueeze(0))' .
Thank you.
from ssd.pytorch.
I see.. I think setting the default tensor to be cuda might solve it, try to put the following somewhere before model loading:
if torch.cuda.is_available():
torch.set_default_tensor_type('torch.cuda.FloatTensor')
from ssd.pytorch.
That's doesn't work, same problem.
from ssd.pytorch.
Yes it works!
torch.set_default_tensor_type('torch.cuda.FloatTensor')
Should before net = build_ssd('test', 300, 21)
Thank you very much !!
from ssd.pytorch.
@alexkoltun
I'm sorry but, when I train my network on gpu by below code,
if torch.cuda.is_available():
net = net.cuda()
Why there is another need when I'm training for example in train.py
if args.cuda:
images = images.cuda()
targets = [ann.cuda() for ann in targets]
else:
images = images
targets = [ann for ann in targets]
Is there also diffenrence between below two line??
images = images.cuda()
# and
images = images
Thanks ahead.
from ssd.pytorch.
Related Issues (20)
- nvidia.line( NameError: name 'nvidia' is not defined
- what does target actually look like in criterion(out, target)? HOT 3
- Result produced too many boxes HOT 2
- About training only VOC2007 HOT 1
- eval my voc dataset ' __init__() missing 5 required positional arguments' HOT 4
- RuntimeError: Error(s) in loading state_dict for SSD:
- How can I get precision and recall in eval.py
- setting an array element with a sequence. HOT 3
- np.random.choice doesn't support tuple (or something like that) anymore
- ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (6,) + inhomogeneous part. HOT 4
- Do you calculate mAP in the right way ?
- ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (6,) + inhomogeneous part. HOT 5
- sh code error report
- Follow this to get this ancient code works HOT 1
- ValueError: operands could not be broadcast together with shapes HOT 1
- What environment is the best to run test.py?
- Packages versions
- RuntimeError: index 1 is out of bounds for dimension 1 with size 1
- TypeError: forward() missing 1 required positional argument: 'x' HOT 5
- Extract loss for each image in the batch
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ssd.pytorch.