PokerNet-poker recognition: 基于人工神经网络的扑克识别 (5)
结果1

void computeBCValue(cv::Mat mat_img, std::vector<bbox_t> result_vec, std::vector<std::string> obj_names,
int current_det_fps = -1, int current_cap_fps = -1)
{
int const colors[6][3] = { { 1,0,1 },{ 0,0,1 },{ 0,1,1 },{ 0,1,0 },{ 1,1,0 },{ 1,0,0 } };
Cardsets cardsets;
int tempx = 0;
vector<bbox_t> mypoints; //
for (auto &i : result_vec) {
if (i.prob < confidencetheta) { // if I am not confident than 50%, skip this poker
continue;
}
// here we compute the distance w.r.t (0,0)
if (i.h < i.w) {// 3rd
if (i.prob > cardsets.confidence[2]) {
cardsets.confidence[2] = i.prob;
cardsets.cardvalues[2] = Point3f(i.x, i.y, i.obj_id);
}
}
else {
mypoints.push_back(i);
}
}
if (cardsets.cardvalues[2].x > 0) {
//cout << "3rd-" << obj_names[cardsets.cardvalues[2].z] << endl;
}
if (mypoints.size() < 2) { return; }
sort(mypoints.begin(), mypoints.end(), SetSortRule);
int first = 0;
int second = 0;
if (mypoints.size() == 4) {//
if (mypoints[0].prob > mypoints[1].prob) {
//cout << "1st-" << obj_names[mypoints[0].obj_id] << endl;
first = 0;
}
else {
//cout << "1st-" << obj_names[mypoints[1].obj_id] << endl;
first = 1;
}
if (mypoints[2].prob > mypoints[3].prob) {
// cout << "2ed-" << obj_names[mypoints[2].obj_id] << endl;
second = 2;
}
else {
//cout << "2ed-" << obj_names[mypoints[3].obj_id] << endl;
second = 3;
}
}
else if (mypoints.size() == 3) {// if we only detect 3 points, take first one to match with other two decide which is pair
/* details of the theroy are on the notebook page */
int delta_y = mypoints[1].y - mypoints[0].y;
if (getCosineDistance(mypoints[0], mypoints[1]) < getCosineDistance(mypoints[0], mypoints[2]) && delta_y > 100) { // we assume they belong to one card
first = mypoints[0].prob > mypoints[1].prob ? 0 : 1;
second = 2;
}
else {// 0 and 1 not one card
// cout << "1st-" << obj_names[mypoints[0].obj_id] << endl;
second = mypoints[1].prob > mypoints[2].prob ? 1 : 2;
}
}
else if (mypoints.size() == 2) {
if (getCosineDistance(mypoints[0], mypoints[1]) < cosinetheta) { // we assume they belong to one card
first = mypoints[0].prob > mypoints[1].prob ? 0 : 1;
}
else {
second = 1;
}
}
cardsets.confidence[0] = mypoints[first].prob;
cardsets.cardvalues[0] = Point3f(mypoints[first].x, mypoints[first].y, mypoints[first].obj_id);
cardsets.confidence[1] = mypoints[second].prob;
cardsets.cardvalues[1] = Point3f(mypoints[second].x, mypoints[second].y, mypoints[second].obj_id);
ostringstream info;
info << "1st-" << obj_names[mypoints[first].obj_id] << ",confidence-" << setprecision(2) << fixed << mypoints[first].prob << ",";
info << "2ed-" << obj_names[mypoints[second].obj_id] << ",confidence-" << setprecision(2) << fixed << mypoints[second].prob << ",";
if (cardsets.cardvalues[2].x > 0) { info << "3rd-" << obj_names[cardsets.cardvalues[2].z] << ",confidence-" << setprecision(2) << fixed << cardsets.confidence[2] << ","; }
cout << info.str() << endl;
putText(mat_img, info.str(), cv::Point(5, 40), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 255));
}
结果2

void computeDTValue(cv::Mat mat_img, std::vector<bbox_t> result_vec, std::vector<std::string> obj_names,
int current_det_fps = -1, int current_cap_fps = -1)
{
int const colors[6][3] = { { 1,0,1 },{ 0,0,1 },{ 0,1,1 },{ 0,1,0 },{ 1,1,0 },{ 1,0,0 } };
int tempx = 0;
vector<bbox_t> mypoints; //
for (auto &i : result_vec) {
if (i.prob > confidencetheta) { // if I am not confident than 50%, skip this poker
mypoints.push_back(i);
}
}
sort(mypoints.begin(), mypoints.end(), SetSortRulebyConfidence);
int cardids = 0;
float confidence = 0;
if (mypoints.size() > 0) {
cardids = mypoints[0].obj_id;
confidence = mypoints[0].prob;
}
else { //error
cout << "nothing detected" << endl;
}
ostringstream info;
info << "1st-" << obj_names[cardids] << ",confidence-" << setprecision(2) << fixed << confidence << ",";
cout << info.str() << endl;
cv::putText(mat_img, info.str(), cv::Point(5, 40), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 255));
}
PokerNet-poker recognition: 基于人工神经网络的扑克识别 (5)的更多相关文章
- 基于卷积神经网络的人脸识别项目_使用Tensorflow-gpu+dilib+sklearn
https://www.cnblogs.com/31415926535x/p/11001669.html 基于卷积神经网络的人脸识别项目_使用Tensorflow-gpu+dilib+sklearn ...
- Pytorch实现基于卷积神经网络的面部表情识别(详细步骤)
文章目录 一.项目背景 二.数据处理 1.标签与特征分离 2.数据可视化 3.训练集和测试集 三.模型搭建 四.模型训练 五.完整代码 一.项目背景数据集cnn_train.csv包含人类面部表情的图 ...
- 基于卷积神经网络的面部表情识别(Pytorch实现)----台大李宏毅机器学习作业3(HW3)
一.项目说明 给定数据集train.csv,要求使用卷积神经网络CNN,根据每个样本的面部图片判断出其表情.在本项目中,表情共分7类,分别为:(0)生气,(1)厌恶,(2)恐惧,(3)高兴,(4)难过 ...
- 深度学习项目——基于卷积神经网络(CNN)的人脸在线识别系统
基于卷积神经网络(CNN)的人脸在线识别系统 本设计研究人脸识别技术,基于卷积神经网络构建了一套人脸在线检测识别系统,系统将由以下几个部分构成: 制作人脸数据集.CNN神经网络模型训练.人脸检测.人脸 ...
- 硕毕论文_基于 3D 卷积神经网络的行为识别算法研究
论文标题:基于 3D 卷积神经网络的行为识别算法研究 来源/作者机构情况: 中 国 地 质 大 学(北京),计算机学院,图像处理方向 解决问题/主要思想贡献: 1. 使用张量CP分解的原理, ...
- C#中调用Matlab人工神经网络算法实现手写数字识别
手写数字识别实现 设计技术参数:通过由数字构成的图像,自动实现几个不同数字的识别,设计识别方法,有较高的识别率 关键字:二值化 投影 矩阵 目标定位 Matlab 手写数字图像识别简介: 手写 ...
- 人工神经网络简介和单层网络实现AND运算--AForge.NET框架的使用(五)
原文:人工神经网络简介和单层网络实现AND运算--AForge.NET框架的使用(五) 前面4篇文章说的是模糊系统,它不同于传统的值逻辑,理论基础是模糊数学,所以有些朋友看着有点迷糊,如果有兴趣建议参 ...
- 基于BP神经网络的字符识别研究
基于BP神经网络的字符识别研究 原文作者:Andrew Kirillov. http://www.codeproject.com/KB/cs/neural_network_ocr.aspx 摘要:本文 ...
- 人工神经网络--ANN
神经网络是一门重要的机器学习技术.它是目前最为火热的研究方向--深度学习的基础.学习神经网络不仅可以让你掌握一门强大的机器学习方法,同时也可以更好地帮助你理解深度学习技术. 本文以一种简单的,循序的方 ...
随机推荐
- cesium相关学习网址
cesium相关学习网址: cesium资料大全网址:https://www.cnblogs.com/cesium1/p/10062942.html http://192.168.101. ...
- 前端(二十一)—— vue指令:文本类指令、避免页面闪烁、v-bind指令、v-on指令、v-model指令、条件渲染指令、列表渲染指令
文本类指令.v-bind指令.v-on指令.v-model指令.条件渲染指令.列表渲染指令 一.文本操作 v-text:文本变量 <p v-text='msg'></p> &l ...
- [未解决]报错:SSLError
参考网友解决的方法 任何报SSLError类的错,解决方法: 引入ssl模块 import ssl 在url链接代码上方添加语句: ssl._create_default_https_context ...
- swagger2 注解说明 ( @ApiImplicitParams )
@Api:用在请求的类上,表示对类的说明 tags="说明该类的作用,可以在UI界面上看到的注解" value="该参数没什么意义,在UI界面上也看到,所以不需要配置&q ...
- 不走弯路,微信小程序的快速入门?
微信小程序下载注册地址:https://mp.weixin.qq.com/cgi-bin/wx 微信小程序登开发者平台地址(可以查看小程序APPID):https://mp.weixin.qq.com ...
- wangEditor 图片上传失败提示
wangEditor 官网自定义上传事件:https://www.kancloud.cn/wangfupeng/wangeditor2/123689 声明:我用的wangEditor版本是2.1.23 ...
- 关于springmvc与ajax的交互-开发记录
每次都栽在这个地方,好衰! 在jsp页面的<form>标签设置了action="请求url" ,button那里用js进行监听,点击触发ajax方法,将前台数据传到后台 ...
- Django完成常用四大功能
返回主目录:Django框架 内容目录: 1.pycharm连接数据库及相应操作 2.手撸登录注册编辑删除 2.1 登录.注册 2.2 ORM简单操作 2.3 编辑.删除 3.完整代码 一.pycha ...
- sqlmap结合burpsuite对post请求进行注入测试
1. 浏览器打开目标地址 http://testasp.vulnweb.com/Login.asp 2. 配置burp代理(127.0.0.1:8080)以拦截请求 3. 点击login表单的subm ...
- 2.Struts2配置文件
1.配置文件的加载顺序 0. 需要掌握 * 加载了哪些个配置文件(重点的) * 配置文件的名称是什么 * 配置文件的位置 * 配置文件的 ...