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
神经网络是一门重要的机器学习技术.它是目前最为火热的研究方向--深度学习的基础.学习神经网络不仅可以让你掌握一门强大的机器学习方法,同时也可以更好地帮助你理解深度学习技术. 本文以一种简单的,循序的方 ...
随机推荐
- LeetCode 分隔链表
题目链接:https://leetcode-cn.com/problems/partition-list/ 题目大意 略. 分析 空间复杂度 O(1) 的做法蛮有意思的,另外加头结点可以少写很多代码. ...
- Gerrit(1): Manage Projects
1) Register an openid account https://login.ubuntu.com/+login 2) Custom settings set SSH pubkey set ...
- Spring Boot整合Thymeleaf模板引擎
什么是Thymeleaf Thymeleaf是一款用于渲染XML.XHTML.HTML5内容的模板引擎.类似Velocity,FreeMaker模板引擎,它也可以轻易的与Spring MVC等Web框 ...
- android应用的资源
应用资源可以分为两大类: 1.无法直接访问的原生资源,保存在asset目录下. 2.可以通过R资源清单类访问的资源,保存在res目录下. 资源的类型以及存储方式: android要求在res目录下用不 ...
- Linux 中 sqlite3 基本操作
https://www.runoob.com/sqlite/sqlite-commands.html 一 .linux 下安装数据库和创建一个数据库 1. Linux 下安装sqlite3 需要两个命 ...
- JMeter学习篇(一):测试实例讲解
1.JMeter的下载与安装 Jmeter官方下载地址:http://jmeter.apache.org/download_jmeter.cgi,下载jmeter是一个zip压缩包,解压后,直接运行a ...
- python 编写暴力破解mysql用户名密码
本文摘自别人的,自己运行调试了一下#!/user/bin/env python#-*- coding:utf-8 -*- import pymysql#导入连接数据库的模块import sys cla ...
- Linux下安装SkyWalking 6.1版本 以及.NETCore项目集成
SkyWalking和APM介绍 今天给大家给大家介绍一下SkyWalking,那什么是SkyWalking Skywalking 是 Apache 基金会下面的一个开源 APM 项目 ,那什么又是A ...
- PagedLOD模型对象选择关键技术点
DatabaseCacheReadCallback这个类继承ReadCallback,在相交的测试中,场景可能有PagedLOD,而计算相交过程中,PagedLOD不是精度最高的节点,这样计算的就不准 ...
- Change myself to be better
发现和改变自己不好的习惯 遇到问题的反应 自己遇到问题的时候,特别是不熟悉的问题的时候就会有点焦虑,这个应该是每个人都会有的,遇到自己不熟悉的或者是没有经历过的东西都会 感觉不舒服,或者是遇到难题或者 ...