xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 5KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-20
  • 語(yǔ)言: C/C++
  • 標(biāo)簽: CTensorFLow??facenet??

資源簡(jiǎn)介

c++簡(jiǎn)單調(diào)用 facenet模型,并對(duì)比歐式距離.使用了opencv做人臉檢測(cè).其中一些參數(shù)暫時(shí)寫死了.目前的效果一般般.因?yàn)?opencv對(duì)人臉的不同姿態(tài)檢測(cè)并不是太準(zhǔn).(暫時(shí)依賴于Qt的QString 和 QImage )

資源截圖

代碼片段和文件信息

#include?“TensorFlow.h“



CTensorFlow::CTensorFlow()
{
m_strxmlPath?=?“E:/SmartCity2015/AI/testTensorFlow/opencv/lib/haarcascade_frontalface_default.xml“;
}


CTensorFlow::~CTensorFlow()
{
}

bool?CTensorFlow::Create()
{
//? m_pLabel1?=?pLabel1;
//? m_pLabel2?=?pLabel2;

Scope?m_root?=?Scope::NewRootScope();
Status?status?=?NewSession(SessionOptions()?&m_pSession);//創(chuàng)建新會(huì)話Session


QString?strModelPath?=?“E:/SmartCity2015/AI/testTensorFlow/x64/Debug/20170512-110547.pb“;

GraphDef?graphdef;?//Graph?Definition?for?current?model
Status?status_load?=?ReadBinaryProto(Env::Default()?strModelPath.toStdString()?&graphdef);?//從pb文件中讀取圖模型;
if?(!status_load.ok())?{
std::cout?< std::cout?< return?false;
}
Status?status_create?=?m_pSession->Create(graphdef);?//將模型導(dǎo)入會(huì)話Session中;
if?(!status_create.ok())?{
std::cout?< m_bIsSessionOk?=?false;
return?false;
}
cout?<
m_bIsSessionOk?=?true;

return?true;
}

void?CTensorFlow::Destroy()
{
if?(m_pSession)
{
m_pSession->Close();
delete?m_pSession;
m_pSession?=?NULL;
}

m_bIsSessionOk?=?false;
}

int?CTensorFlow::Run(const?string&?strPicture1?const?string&?strPicture2?float&?fDistance?vector&?arrFaces1?vector&?arrFaces2)
{
if?(m_bIsSessionOk?==?false)
{
return?-1;
}

m_strPicture1?=?strPicture1;
m_strPicture2?=?strPicture2;

int?nHeight?=?160;
int?nWidth?=?160;

m_nTotalRecognition++;
Tensor?tensorPic1;
Tensor?tensorPic2;

bool?bRet?=?GetPicTensor(strPicture1?nHeight?nWidth?tensorPic1?arrFaces1);
if?(bRet?==?false)
{
m_nRecognitionFail++;
return?0;
}
bRet?=?GetPicTensor(strPicture2?nHeight?nWidth?tensorPic2?arrFaces2);
if?(bRet?==?false)
{
m_nRecognitionFail++;
return?0;
}
vector?arrData1;
GetValueFromTensor(tensorPic1?arrData1);
vector?arrData2;
GetValueFromTensor(tensorPic2?arrData2);

fDistance?=?Euclidean(arrData1?arrData2);
std::cout?<
if?(fDistance?>?m_fThreshold)
{
m_nMoreThenThreshold++;
}

return?1;
}

int?CTensorFlow::Run(const?unsigned?char*?pPictureData1?const?unsigned?char*?pPictureData2?float&?fDistance)
{
if?(m_bIsSessionOk?==?false)
{
return?-1;
}

int?nHeight?=?160;
int?nWidth?=?160;

Tensor?tensorPicture1;
Tensor?tensorPicture2;
bool?bRet?=?GetPicTensor(pPictureData1?nHeight?nWidth?tensorPicture1);
if?(bRet?==?false)
{
m_nRecognitionFail++;
return?0;
}
bRet?=?GetPicTensor(pPictureData2?nHeight?nWidth?tensorPicture2);
if?(bRet?==?false)
{
m_nRecognitionFail++;
return?0;
}
vector?arrData1;
GetValueFromTensor(tensorPicture1?

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????17626??2018-07-20?15:44??TensorFlow.cpp

?????文件???????3739??2018-07-20?15:40??TensorFlow.h

-----------?---------??----------?-----??----

????????????????21365????????????????????2


評(píng)論

共有 條評(píng)論

相關(guān)資源