Comments (8)
from facedetection-dsfd.
My torch version is 0.4, and I was facing the same issue, so I updated the following code, and now it is working.
def infer(net , img , transform , thresh , cuda , shrink):
if shrink != 1:
img = cv2.resize(img, None, None, fx=shrink, fy=shrink, interpolation=cv2.INTER_LINEAR)
x = torch.from_numpy(transform(img)[0]).permute(2, 0, 1)
with torch.no_grad():
x = Variable(x.unsqueeze(0))
if cuda:
x = x.cuda()
#print (shrink , x.shape)
y = net(x) # forward pass
detections = y.data
# scale each detection back up to the image
scale = torch.Tensor([ img.shape[1]/shrink, img.shape[0]/shrink,
img.shape[1]/shrink, img.shape[0]/shrink] )
det = []
for i in range(detections.size(1)):
j = 0
while detections[0, i, j, 0] >= thresh:
score = detections[0, i, j, 0].cpu().numpy()
#label_name = labelmap[i-1]
pt = (detections[0, i, j, 1:]*scale).cpu().numpy()
#print ("#"*20,type(pt), pt)
coords = (pt[0], pt[1], pt[2], pt[3])
det.append([pt[0], pt[1], pt[2], pt[3], score])
j += 1
if (len(det)) == 0:
det = [ [0.1,0.1,0.2,0.2,0.01] ]
det = np.array(det)
keep_index = np.where(det[:, 4] >= 0)[0]
det = det[keep_index, :]
return det
from facedetection-dsfd.
Can you please specify your pytorch version?
from facedetection-dsfd.
Hi
Facing a similar issue, Not able to run the demo.py file.
from facedetection-dsfd.
@ChandanKumarAAI Were you able to get predictions using the demo.py file?
from facedetection-dsfd.
@DecentMakeover yes I was able to get prediction from demo.py.
from facedetection-dsfd.
Okay let me try this.
from facedetection-dsfd.
@AnberLu @ChandanKumarAAI @DecentMakeover
It's mainly caused by torch version. Someone faces this similar problem. The torch version we used is 0.3.1.
from facedetection-dsfd.
Related Issues (20)
- how about the eval_tools? HOT 1
- Add 'configuration' files to install requirements easily
- TypeError: mul(): The parameter'other' (position 1) must be Tensor, not numpy.ndarray
- Excuse me, how to train the network? I don't seem to see the code about the training model
- How can we use webcam to test our DSFD model.
- FileNotFoundError: [Errno 2] No such file or directory: '/data/wider_face_split\\wider_face_val.mat' HOT 2
- [SOLVED] How to Implement DSFD on Windows, Mac, and Linux HOT 9
- [SOLVED] How to Implement DSFD on Windows, Mac, and Linux
- RandomBaiduCrop
- How do I test multiple images using Demo.py HOT 1
- TypeError: can't convert cuda:0 device type tensor to numpy. HOT 1
- Error in running demo.py
- demo.py RuntimeError: Legacy autograd function with non-static forward method is deprecated. HOT 2
- TypeError: forward() missing 1 required positional argument: 'x' HOT 5
- How do I test the video in the demo.py?
- GPU out of memory HOT 1
- Fix RuntimeError: Legacy autograd function with non-static forward method is deprecated
- training code
- Legacy autograd function with non-static forward method is deprecated.
- 论文里SSL损失函数公式最外面那个括号是不是放错位置了
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 facedetection-dsfd.