Comments (5)
Okay, there was a bug in NMS which caused to give > 0 IOU threshhold for two boxes that didn't overlap. I pushed it just yesterday, but couldn't check it on GPU as I don't have access to one on weekdends. It works fine on CPU.
Your solution would then break the code on CPU, since .cuda() will raise an error. The best way to go about it would be to use torch.maximum
or something. I'll look into it in a couple of hours and push the changes. Thanks for pointing out the bug though. If you could verify it with torch.max, perhaps you could make a pull request too. It'll be a few hours before I can push the fix.
from yolo_v3_tutorial_from_scratch.
I've fixed the issue. It works fine on GPU now.
from yolo_v3_tutorial_from_scratch.
if torch.cuda.is_available():
inter_area = torch.max(inter_rect_x2 - inter_rect_x1 + 1,torch.zeros(inter_rect_x2.shape).cuda())*torch.max(inter_rect_y2 - inter_rect_y1 + 1, torch.zeros(inter_rect_x2.shape).cuda())
else:
inter_area = torch.max(inter_rect_x2 - inter_rect_x1 + 1,torch.zeros(inter_rect_x2.shape))*torch.max(inter_rect_y2 - inter_rect_y1 + 1, torch.zeros(inter_rect_x2.shape))
It's better to use torch.clamp, so you don't actually need memory allocation for tensor of zeros:
nter_area = torch.clamp(inter_rect_x2 - inter_rect_x1 + 1,min=0)*torch.clamp(inter_rect_y2 - inter_rect_y1 + 1, 0)
from yolo_v3_tutorial_from_scratch.
Can you make a pull request? I'm. A bit busy with college stuff that I can't access my work PC right now. I made the above pushes directly from the website. I agree with the choice of ,torch.clamp
( I have used the function to clip bounding boxes that exceed dimensions of the image). Plus. If you are gonna do the PR, please make sure the code works both on CUDA and CPU. I guess clamp is device agnostic but I can't exactly nail it down. And yes, the min arg to clamp should be 0.0 instead of 0 since it's a FloatTensor. Thanks for the suggestion.
from yolo_v3_tutorial_from_scratch.
Thank you both for the quick fix
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.