Comments (4)
Have you solved it?
This is a problem that arises because the elements being computed go into the cpu and gpu respectively.
At line 531 of the 'general.py' file, t(target) goes into gpu and anchor goes into cpu, so when you divide anchor by t, an error occurs.
This is solved by sending the anchor to the gpu before the calculation takes place.
The code is anchor = anchor.to(device='cuda').
Please understand that I am unfamiliar with using github.
I added "anchors = anchors.to(device='cuda')" in 141 line in loss.py file and that been work! (06.09.2021)
Now, my code in loss.py (135-149 line) look like
for i, jj in enumerate(model.module.yolo_layers if multi_gpu else model.yolo_layers):
# get number of grid points and anchor vec for this yolo layer
anchors = model.module.module_list[jj].anchor_vec if multi_gpu else model.module_list[jj].anchor_vec
gain[2:] = torch.tensor(p[i].shape)[[3, 2, 3, 2]] # xyxy gain
# Match targets to anchors
anchors = anchors.to(device='cuda')
a, t, offsets = [], targets * gain, 0
if nt:
na = anchors.shape[0] # number of anchors
at = torch.arange(na).view(na, 1).repeat(1, nt) # anchor tensor, same as .repeat_interleave(nt)
r = t[None, :, 4:6] / anchors[:, None] # wh ratio
j = torch.max(r, 1. / r).max(2)[0] < model.hyp['anchor_t'] # compare
# j = wh_iou(anchors, t[:, 4:6]) > model.hyp['iou_t'] # iou(3,n) = wh_iou(anchors(3,2), gwh(n,2))
a, t = at[j], t.repeat(na, 1, 1)[j] # filter
from scaledyolov4.
Have you solved it?
from scaledyolov4.
Have you solved it?
Sorry I don't. So I run it in DDP mode[Laugh and cry]. It runs well.
from scaledyolov4.
Have you solved it?
This is a problem that arises because the elements being computed go into the cpu and gpu respectively.
At line 531 of the 'general.py' file, t(target) goes into gpu and anchor goes into cpu, so when you divide anchor by t, an error occurs.
This is solved by sending the anchor to the gpu before the calculation takes place.
The code is anchor = anchor.to(device='cuda').
Please understand that I am unfamiliar with using github.
from scaledyolov4.
Related Issues (20)
- Issue with reported confidence level of the single-cls scaled yolov4 csp implementation
- single GPU in training HOT 4
- RuntimeError: result type Float can't be cast to the desired output type long int HOT 2
- Fail to transfer .pt into .onnx
- Question about the loss function
- how to train the trick to achive goals?
- YOLOv4-P6 convert torch .pt to darknet .weights
- is there a mask(segmentation) branch for scaledYOLOv4 project?
- Train.py runtime error, Float can't be cast to the desired output type long int HOT 1
- wrong calculation of map
- Pretrained checkpoints?
- The fps of YOLOV4-CSP?
- why mish-cuda?
- When I run the test.py in docker, one issue appeared. HOT 2
- Could not download models
- Could not download pretrained models such as yolov4-p5.pt,yolov4-p6.pt,yolov4-p7.pt file
- I Could not download pretrained models such as yolov4-p5.pt,yolov4-p6.pt,yolov4-p7.pt file. Could you please help me.
- Error while training the yolov7 model _pickle.UnpicklingError: STACK_GLOBAL requires str HOT 2
- Looking for yolov4 weights HOT 2
- RuntimeError: Trying to create tensor with negative dimension -920509440: [-920509440]
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 scaledyolov4.