我想dlib用python进行图像识别.我在Windows 10上使用OpenCV运行的python应用程序很棒,但是当我想dlib从cmd它安装它时会出现以下错误:
错误:找不到cmake,确保它已安装并且在路径中.您可以使用https://cmake.org/install/上的说明安装cmake. 您也可以使用--cmake参数指定其路径.
我该怎么办?
我正在尝试为iOS项目构建DLIB.cmake在一个libdlib.a和一个.o文件加载中运行结果.
当我将库添加到Xcode项目时,我得到警告,该库尚未构建arm64.
我的问题分为两部分:
cmake **path_to_source** -DCMAKE_OSX_ARCHITECTURE="arm64"但它导致了大量的错误,例如unknown type name '__uint32_t'; did you mean '__uint128_t')?.o运行cmake时构建的所有文件的目的是什么?我需要将它们包含在Xcode项目中吗?我目前正在学习使用Python的OpenCV API,这一切都很好.我正在取得不错的进展.部分内容来自Python语法的简单性,而不是将其与C++一起使用,我还没有尝试过.我已经意识到,如果我打算做任何生产质量,我必须在某些时候弄脏OpenCV的C++绑定.
就在最近,我遇到了dlib,它也声称可以完成OpenCV所做的所有事情.它用C++编写,也提供Python API(惊喜).任何人都可以根据自己的实施经验担保dlib吗?
我正在尝试安装dlibPython库.在某些系统(macOS,股票Ubuntu 14.04)pip install dlib工作正常,但在我们的CircleCI环境的Ubuntu 14.x中,它失败并出现以下错误.
Linking CXX shared library dlib.so
/usr/bin/ld: /opt/circleci/python/2.7.11/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against '_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
error: cmake build failed!
Run Code Online (Sandbox Code Playgroud)
可能有什么不对?
很抱歉,如果这是基本的,但我正在尝试安装dlib以与python一起使用,如(http://blog.dlib.net/2014/04/dlib-187-released-make-your-own-object.html中所述))"用Python制作你自己的物体探测器!".
我在安装说明中下载了安装文件,解压缩并使用了cmake(http://dlib.net/compile.html)
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
Run Code Online (Sandbox Code Playgroud)
这看起来很好
但是在Python中键入"import dlib"只会产生ImportError:没有名为dlib的模块.
知道如何告诉Python如何查找/使用该东西吗?
我正在尝试修改Dlib的面部检测示例,以便将检测到的图像保存到文件中,因为我使用的是没有GUI的服务器.到目前为止,我只想到了如何保存图像而不是叠加层.如何将两者保存到同一个文件?
//win.add_overlay(dets, rgb_pixel(255,0,0));
save_png(img, "detected.png");
Run Code Online (Sandbox Code Playgroud) 按照使用cmake(此处)编译dlib的说明生成一个静态dlib库:
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
Run Code Online (Sandbox Code Playgroud)
如何指示cmake生成共享(.so)库?
我想通过裁剪矩形来保存检测到的面在dlib中有人知道我怎么能裁剪它.我第一次使用dlib并遇到很多问题.我还想在检测到的面上运行fisherface算法,但是当我将检测到的矩形传递给pridictor时,它给出了类型错误.我在这个问题上真的需要帮助.
import cv2, sys, numpy, os
import dlib
from skimage import io
import json
import uuid
import random
from datetime import datetime
from random import randint
#predictor_path = sys.argv[1]
fn_haar = 'haarcascade_frontalface_default.xml'
fn_dir = 'att_faces'
size = 4
detector = dlib.get_frontal_face_detector()
#predictor = dlib.shape_predictor(predictor_path)
options=dlib.get_frontal_face_detector()
options.num_threads = 4
options.be_verbose = True
win = dlib.image_window()
# Part 1: Create fisherRecognizer
print('Training...')
# Create a list of images and a list of corresponding names
(images, lables, names, id) = ([], [], {}, …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用中文耳语算法进行面部聚类.我已经使用DLIB和Python,用于提取每个面的特征和如在由Davisking描述映射到128 d矢量https://github.com/davisking/dlib/blob/master/examples/dnn_face_recognition_ex.cpp.
然后我按照那里的指示构建了一个图表.我实现了中文耳语算法并应用于此图.谁能告诉我我做了什么错?任何人都可以使用中文耳语算法上传面部聚类的python代码吗?这是我的中国私语代码:
import networkx as nx
import random
from random import shuffle
import math
def chinese_whispers(nodes,edges,iterations):
G = nx.Graph()
G.add_nodes_from(nodes)
#print(G.node)
for n, v in enumerate(nodes):
G.node[n]['class'] = v
#print(n,v)
G.add_edges_from(edges)
#gn=G.nodes()
#for node in gn:
#print((node,G[node],G.node,G.node[node]))
#(0, {16: {'weight': 0.49846761956907698}, 14: {'weight': 0.55778036559581601}, 7: {'weight': 0.43902511314524784}}, {'class': 0})
for z in range(0, iterations):
gn = G.nodes()
# I randomize the nodes to give me an arbitrary start point
shuffle(gn)
for node in gn:
neighs = G[node] …Run Code Online (Sandbox Code Playgroud) 我已经有一个面部标志检测器,可以使用opencv和dlib保存图像,代码如下:
# import the necessary packages
from imutils import face_utils
import numpy as np
import argparse
import imutils
import dlib
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-p", "--shape-predictor", required=True, help="Path to facial landmark predictor")
ap.add_argument("-i", "--image", required=True, help="Path to input image")
args = vars(ap.parse_args())
# initialize dlib's face detector (HOG-based) and then create the facial landmark predictor
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor(args["shape_predictor"])
# load the input image, resize it, and convert …Run Code Online (Sandbox Code Playgroud)