Comments (4)
希望作者有空上传一下能跑通GPU的版本,感谢~
这套程序里,有的算法是基于pytorch框架运行的,有的是调用opencv运行的。在基于Pytorch框架运行的程序里,有device = 'cuda' if torch.cuda.is_available() else 'cpu'这行代码,它会根据运行设备自适应切换到cpu或者gpu环境的,而调用opencv的程序在cpu和gpu环境是通用的
from 10kinds-light-face-detector-align-recognition.
嗯,检测到cuda可用,device是'cuda',可是跑不通啊,各种错误
from 10kinds-light-face-detector-align-recognition.
比如pfld_mtcnn\detector.py报错如下:
Traceback (most recent call last):
File "D:/studyFiles/CV/face_detection/ten_kinds/Run_all_compare_time.py", line 78, in
mtcnn_result, _ = mtcnn_detect.detect(srcimg)
File "D:\studyFiles\CV\face_detection\ten_kinds\mtcnn_pfld_landmark.py", line 15, in detect
bounding_boxes, landmarks = self.mtcnn.detect(srcimg) ###landmarks: numpy array, n x 10 (x1, x2 ... x5, y1, y2 ..y5)
File "D:\studyFiles\CV\face_detection\ten_kinds\pfld_mtcnn\detector.py", line 392, in detect
boxes = run_first_stage(image, self.pnet, scale=s, threshold=self.thresholds[0])
File "D:\studyFiles\CV\face_detection\ten_kinds\pfld_mtcnn\detector.py", line 246, in run_first_stage
output = net(img)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\studyFiles\CV\face_detection\ten_kinds\pfld_mtcnn\detector.py", line 170, in forward
x = self.features(x)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\container.py", line 119, in forward
input = module(input)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\conv.py", line 399, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\conv.py", line 395, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
from 10kinds-light-face-detector-align-recognition.
比如pfld_mtcnn\detector.py报错如下:
Traceback (most recent call last):
File "D:/studyFiles/CV/face_detection/ten_kinds/Run_all_compare_time.py", line 78, in
mtcnn_result, _ = mtcnn_detect.detect(srcimg)
File "D:\studyFiles\CV\face_detection\ten_kinds\mtcnn_pfld_landmark.py", line 15, in detect
bounding_boxes, landmarks = self.mtcnn.detect(srcimg) ###landmarks: numpy array, n x 10 (x1, x2 ... x5, y1, y2 ..y5)
File "D:\studyFiles\CV\face_detection\ten_kinds\pfld_mtcnn\detector.py", line 392, in detect
boxes = run_first_stage(image, self.pnet, scale=s, threshold=self.thresholds[0])
File "D:\studyFiles\CV\face_detection\ten_kinds\pfld_mtcnn\detector.py", line 246, in run_first_stage
output = net(img)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\studyFiles\CV\face_detection\ten_kinds\pfld_mtcnn\detector.py", line 170, in forward
x = self.features(x)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\container.py", line 119, in forward
input = module(input)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\conv.py", line 399, in forward
return self._conv_forward(input, self.weight, self.bias)
File "D:\Softwares\Anaconda3\envs\pytorch_env\lib\site-packages\torch\nn\modules\conv.py", line 395, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
这个错误的原因很简单呀,就是网络结构model转换到gpu环境了,但是输入张量Input没有转换到gpu环境,因此你需要在输入张量Input后加上.to(device)
这是我编写程序的一个疏忽,当初这些网络都是轻量级的,我就在win10-cpu机器上编写程序,没有放在gpu设备上调试,请谅解
from 10kinds-light-face-detector-align-recognition.
Related Issues (20)
- 关于准确率评估
- 关于PFLD算法 HOT 1
- opencv版本问题
- Model Files on some other drive
- OMP: Error
- 检测
- 模型文件
- 有借鉴意义
- 哪个最快
- 您好,最近的scrfd运行不了,会报错,是代码的问题。您可以检查一下吗
- 你好,想请教下RetinafaceDetector_dnn这个函数在哪里? HOT 1
- libfacedetect_align_module有问题,输出的向量尺寸错误 HOT 4
- retina_face 的模型是从哪里获取的?用哪个数据训练的?
- retinaface_detect 与retinaface_dnn_detect区别 HOT 2
- 视频人脸识别 HOT 1
- Run_all_compare_time.py 里如果用GPU跑报错 HOT 4
- 当图像尺度较小时,facebox报错 HOT 1
- 使用mtcnn_pfld_landmark运行getfeature时报错 HOT 2
- detec_face_align_rec.py报错 HOT 5
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 10kinds-light-face-detector-align-recognition.