Comments (4)
HI @Anikily ,
I can reproduce the error you encountered on my PC (os: windows10, cuda: available).
Then I do the debug, where x_y_offset.is_cuda = True, but prediction.is_cuda = False.
So I think you might be right, one in GPU but the other in CPU.
Then I added few lines in darknet.py (just pick somewhere looks suitable ...) so that prediction.is_cuda can be True later.
# Transform
x = x.data
if CUDA:
x = x.cuda()
Now it pass with exit code 0.
But I still not sure where is a good place to put x = x.cuda() ...
from yolo_v3_tutorial_from_scratch.
Hi @arashilen , thansks for your reply.I have solved this problem yesterday in a similar way to yours.And I did this step in util.py...in just ablove the line which reported the error.
from yolo_v3_tutorial_from_scratch.
Hi @Anikily ,
Maybe you can debug value of x["anchors"] first.
E.g. my case would be this:
x["anchors"] = '10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326'
which is come from https://github.com/ayooshkathuria/YOLO_v3_tutorial_from_scratch/blob/master/cfg/yolov3.cfg
os: macos
from yolo_v3_tutorial_from_scratch.
thanks ,I have solved this problem, and I encountered another problem :
Traceback (most recent call last):
File "darknet.py", line 238, in
pred = model(inp,torch.cuda.is_available())
File "/home/tensor/anaconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "darknet.py", line 227, in forward
x = predict_transform(x,inp_dim,anchors,num_classes,CUDA)
File "/home/tensor/jupyter/luyu/yolo3/util.py", line 79, in predict_transform
prediction[:,:,:2] += x_y_offset
RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #4 'other'
maybe it means that the type of x_y_offset is torch,cuda.FloatTensor,but the type of prediction is torch.FloatTensor and they are not at the same memory address.How should I do?Transform the type of prediction to Cuda?
from yolo_v3_tutorial_from_scratch.
Related Issues (20)
- In function prep_image
- What is loading batch?
- yolov3-tiny model image dimensions error
- how to run detect.py
- google colab
- testing object detector
- bounding boxes not correct HOT 1
- How to solve this runtime error problem? HOT 1
- darknet spp maxpool
- 'NoneType' object has no attribute 'shape' HOT 1
- cv2.imwrite doesn't output image HOT 1
- the problem of function "predict_transform" HOT 1
- Why does batch norm layer has the parameter of weight and bias? HOT 2
- Why do we reverse the final dim of the image in "prep_image"? HOT 1
- Quick question
- RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 'self' in call to _thnn_conv2d_forward
- OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function 'rectangle' HOT 4
- Anchors scaling for each feature map output HOT 1
- Object detection algorithms
- why no images saved in the directory named 'det' HOT 2
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 yolo_v3_tutorial_from_scratch.