Python 人脸表情识别

2023-11-17



环境搭建可查看Python人脸识别微笑检测


数据集可在https://inc.ucsd.edu/mplab/wordpress/index.html%3Fp=398.html获取

数据如下:
在这里插入图片描述


一、图片预处理


import dlib         # 人脸识别的库dlib
import numpy as np  # 数据处理的库numpy
import cv2          # 图像处理的库OpenCv
import os
 
# dlib预测器
detector = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor('shape_predictor_68_face_landmarks.dat')
 
# 读取图像的路径
path_read = ".\ImageFiles\\files"
num=0
for file_name in os.listdir(path_read):
	#aa是图片的全路径
    aa=(path_read +"/"+file_name)
    #读入的图片的路径中含非英文
    img=cv2.imdecode(np.fromfile(aa, dtype=np.uint8), cv2.IMREAD_UNCHANGED)
    #获取图片的宽高
    img_shape=img.shape
    img_height=img_shape[0]
    img_width=img_shape[1]
   
    # 用来存储生成的单张人脸的路径
    path_save=".\ImageFiles\\files1" 
    # dlib检测
    dets = detector(img,1)
    print("人脸数:", len(dets))
    for k, d in enumerate(dets):
        if len(dets)>1:
            continue
        num=num+1
        # 计算矩形大小
        # (x,y), (宽度width, 高度height)
        pos_start = tuple([d.left(), d.top()])
        pos_end = tuple([d.right(), d.bottom()])
 
        # 计算矩形框大小
        height = d.bottom()-d.top()
        width = d.right()-d.left()
 
        # 根据人脸大小生成空的图像
        img_blank = np.zeros((height, width, 3), np.uint8)
        for i in range(height):
            if d.top()+i>=img_height:# 防止越界
                continue
            for j in range(width):
                if d.left()+j>=img_width:# 防止越界
                    continue
                img_blank[i][j] = img[d.top()+i][d.left()+j]
        img_blank = cv2.resize(img_blank, (200, 200), interpolation=cv2.INTER_CUBIC)

        cv2.imencode('.jpg', img_blank)[1].tofile(path_save+"\\"+"file"+str(num)+".jpg") # 正确方法

运行结果:

在这里插入图片描述



二、数据集划分

import os, shutil
# 原始数据集路径
original_dataset_dir = '.\ImageFiles\\files1'

# 新的数据集
base_dir = '.\ImageFiles\\files2'
os.mkdir(base_dir)

# 训练图像、验证图像、测试图像的目录
train_dir = os.path.join(base_dir, 'train')
os.mkdir(train_dir)
validation_dir = os.path.join(base_dir, 'validation')
os.mkdir(validation_dir)
test_dir = os.path.join(base_dir, 'test')
os.mkdir(test_dir)

train_cats_dir = os.path.join(train_dir, 'smile')
os.mkdir(train_cats_dir)

train_dogs_dir = os.path.join(train_dir, 'unsmile')
os.mkdir(train_dogs_dir)

validation_cats_dir = os.path.join(validation_dir, 'smile')
os.mkdir(validation_cats_dir)

validation_dogs_dir = os.path.join(validation_dir, 'unsmile')
os.mkdir(validation_dogs_dir)

test_cats_dir = os.path.join(test_dir, 'smile')
os.mkdir(test_cats_dir)

test_dogs_dir = os.path.join(test_dir, 'unsmile')
os.mkdir(test_dogs_dir)

# 复制1000张笑脸图片到train_c_dir
fnames = ['file{}.jpg'.format(i) for i in range(1,900)]
for fname in fnames:
    src = os.path.join(original_dataset_dir, fname)
    dst = os.path.join(train_cats_dir, fname)
    shutil.copyfile(src, dst)

fnames = ['file{}.jpg'.format(i) for i in range(900, 1350)]
for fname in fnames:
    src = os.path.join(original_dataset_dir, fname)
    dst = os.path.join(validation_cats_dir, fname)
    shutil.copyfile(src, dst)
    
# Copy next 500 cat images to test_cats_dir
fnames = ['file{}.jpg'.format(i) for i in range(1350, 1800)]
for fname in fnames:
    src = os.path.join(original_dataset_dir, fname)
    dst = os.path.join(test_cats_dir, fname)
    shutil.copyfile(src, dst)
    
fnames = ['file{}.jpg'.format(i) for i in range(2127,3000)]
for fname in fnames:
    src = os.path.join(original_dataset_dir, fname)
    dst = os.path.join(train_dogs_dir, fname)
    shutil.copyfile(src, dst)
    
# Copy next 500 dog images to validation_dogs_dir
fnames = ['file{}.jpg'.format(i) for i in range(3000,3304)]
for fname in fnames:
    src = os.path.join(original_dataset_dir, fname)
    dst = os.path.join(validation_dogs_dir, fname)
    shutil.copyfile(src, dst)
    
# # Copy next 500 dog images to test_dogs_dir
# fnames = ['file{}.jpg'.format(i) for i in range(3000,3878)]
# for fname in fnames:
#     src = os.path.join(original_dataset_dir, fname)
#     dst = os.path.join(test_dogs_dir, fname)
#     shutil.copyfile(src, dst)

运行结果:

在这里插入图片描述

在这里插入图片描述



三、识别笑脸


  • 模式构建:
#创建模型
from keras import layers
from keras import models
model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu',input_shape=(150, 150, 3)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Flatten())
model.add(layers.Dense(512, activation='relu'))
model.add(layers.Dense(1, activation='sigmoid'))
model.summary()#查看

在这里插入图片描述


  • 进行归一化
#归一化
from keras import optimizers
model.compile(loss='binary_crossentropy',
              optimizer=optimizers.RMSprop(lr=1e-4),
              metrics=['acc'])
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(rescale=1./255)
validation_datagen=ImageDataGenerator(rescale=1./255)
test_datagen = ImageDataGenerator(rescale=1./255)
train_generator = train_datagen.flow_from_directory(
        # 目标文件目录
        train_dir,
        #所有图片的size必须是150x150
        target_size=(150, 150),
        batch_size=20,
        # Since we use binary_crossentropy loss, we need binary labels
        class_mode='binary')
validation_generator = test_datagen.flow_from_directory(
        validation_dir,
        target_size=(150, 150),
        batch_size=20,
        class_mode='binary')
test_generator = test_datagen.flow_from_directory(test_dir,
                                                   target_size=(150, 150),
                                                   batch_size=20,
                                                   class_mode='binary')
for data_batch, labels_batch in train_generator:
    print('data batch shape:', data_batch.shape)
    print('labels batch shape:', labels_batch)
    break
#'smile': 0, 'unsmile': 1

在这里插入图片描述


  • 增强数据
#数据增强
datagen = ImageDataGenerator(
      rotation_range=40,
      width_shift_range=0.2,
      height_shift_range=0.2,
      shear_range=0.2,
      zoom_range=0.2,
      horizontal_flip=True,
      fill_mode='nearest')
#数据增强后图片变化
import matplotlib.pyplot as plt
# This is module with image preprocessing utilities
from keras.preprocessing import image
train_smile_dir = './ImageFiles//files2//train//smile/'
fnames = [os.path.join(train_smile_dir, fname) for fname in os.listdir(train_smile_dir)]
img_path = fnames[3]
img = image.load_img(img_path, target_size=(150, 150))
x = image.img_to_array(img)
x = x.reshape((1,) + x.shape)
i = 0
for batch in datagen.flow(x, batch_size=1):
    plt.figure(i)
    imgplot = plt.imshow(image.array_to_img(batch[0]))
    i += 1
    if i % 4 == 0:
        break
plt.show()

在这里插入图片描述
在这里插入图片描述


  • 创建网络:
#创建网络
model = models.Sequential()
model.add(layers.Conv2D(32, (3, 3), activation='relu',input_shape=(150, 150, 3)))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Flatten())
model.add(layers.Dropout(0.5))
model.add(layers.Dense(512, activation='relu'))
model.add(layers.Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy',
              optimizer=optimizers.RMSprop(lr=1e-4),
              metrics=['acc'])
#归一化处理
train_datagen = ImageDataGenerator(
    rescale=1./255,
    rotation_range=40,
    width_shift_range=0.2,
    height_shift_range=0.2,
    shear_range=0.2,
    zoom_range=0.2,
    horizontal_flip=True,)

test_datagen = ImageDataGenerator(rescale=1./255)

train_generator = train_datagen.flow_from_directory(
        # This is the target directory
        train_dir,
        # All images will be resized to 150x150
        target_size=(150, 150),
        batch_size=32,
        # Since we use binary_crossentropy loss, we need binary labels
        class_mode='binary')

validation_generator = test_datagen.flow_from_directory(
        validation_dir,
        target_size=(150, 150),
        batch_size=32,
        class_mode='binary')

history = model.fit_generator(
      train_generator,
      steps_per_epoch=100,
      epochs=60,  
      validation_data=validation_generator,
      validation_steps=50)
model.save('smileAndUnsmile1.h5')

#数据增强过后的训练集与验证集的精确度与损失度的图形
acc = history.history['acc']
val_acc = history.history['val_acc']
loss = history.history['loss']
val_loss = history.history['val_loss']

epochs = range(len(acc))

plt.plot(epochs, acc, 'bo', label='Training acc')
plt.plot(epochs, val_acc, 'b', label='Validation acc')
plt.title('Training and validation accuracy')
plt.legend()
plt.figure()

plt.plot(epochs, loss, 'bo', label='Training loss')
plt.plot(epochs, val_loss, 'b', label='Validation loss')
plt.title('Training and validation loss')
plt.legend()
plt.show()

在这里插入图片描述

在这里插入图片描述


  • 单张图片测试:
# 单张图片进行判断  是笑脸还是非笑脸
import cv2
from keras.preprocessing import image
from keras.models import load_model
import numpy as np
#加载模型
model = load_model('smileAndUnsmile1.h5')
#本地图片路径
img_path='test.jpg'
img = image.load_img(img_path, target_size=(150, 150))

img_tensor = image.img_to_array(img)/255.0
img_tensor = np.expand_dims(img_tensor, axis=0)
prediction =model.predict(img_tensor)  
print(prediction)
if prediction[0][0]>0.5:
    result='非笑脸'
else:
    result='笑脸'
print(result)

在这里插入图片描述


  • 摄像头测试:
#检测视频或者摄像头中的人脸
import cv2
from keras.preprocessing import image
from keras.models import load_model
import numpy as np
import dlib
from PIL import Image
model = load_model('smileAndUnsmile1.h5')
detector = dlib.get_frontal_face_detector()
video=cv2.VideoCapture(0)
font = cv2.FONT_HERSHEY_SIMPLEX
def rec(img):
    gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    dets=detector(gray,1)
    if dets is not None:
        for face in dets:
            left=face.left()
            top=face.top()
            right=face.right()
            bottom=face.bottom()
            cv2.rectangle(img,(left,top),(right,bottom),(0,255,0),2)
            img1=cv2.resize(img[top:bottom,left:right],dsize=(150,150))
            img1=cv2.cvtColor(img1,cv2.COLOR_BGR2RGB)
            img1 = np.array(img1)/255.
            img_tensor = img1.reshape(-1,150,150,3)
            prediction =model.predict(img_tensor)    
            if prediction[0][0]>0.5:
                result='unsmile'
            else:
                result='smile'
            cv2.putText(img, result, (left,top), font, 2, (0, 255, 0), 2, cv2.LINE_AA)
        cv2.imshow('Video', img)
while video.isOpened():
    res, img_rd = video.read()
    if not res:
        break
    rec(img_rd)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
video.release()
cv2.destroyAllWindows()

运行结果:
在这里插入图片描述



四、Dlib提取人脸特征识别笑脸和非笑脸


import cv2                     #  图像处理的库 OpenCv
import dlib                    # 人脸识别的库 dlib
import numpy as np             # 数据处理的库 numpy
class face_emotion():
    def __init__(self):
        self.detector = dlib.get_frontal_face_detector()
        self.predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")
        self.cap = cv2.VideoCapture(0)
        self.cap.set(3, 480)
        self.cnt = 0  
    def learning_face(self):
        line_brow_x = []
        line_brow_y = []
        while(self.cap.isOpened()):

            flag, im_rd = self.cap.read()
            k = cv2.waitKey(1)
            # 取灰度
            img_gray = cv2.cvtColor(im_rd, cv2.COLOR_RGB2GRAY)  
            faces = self.detector(img_gray, 0)

            font = cv2.FONT_HERSHEY_SIMPLEX
     
            # 如果检测到人脸
            if(len(faces) != 0):
                
                # 对每个人脸都标出68个特征点
                for i in range(len(faces)):
                    for k, d in enumerate(faces):
                        cv2.rectangle(im_rd, (d.left(), d.top()), (d.right(), d.bottom()), (0,0,255))
                        self.face_width = d.right() - d.left()
                        shape = self.predictor(im_rd, d)
                        mouth_width = (shape.part(54).x - shape.part(48).x) / self.face_width 
                        mouth_height = (shape.part(66).y - shape.part(62).y) / self.face_width
                        brow_sum = 0 
                        frown_sum = 0 
                        for j in range(17, 21):
                            brow_sum += (shape.part(j).y - d.top()) + (shape.part(j + 5).y - d.top())
                            frown_sum += shape.part(j + 5).x - shape.part(j).x
                            line_brow_x.append(shape.part(j).x)
                            line_brow_y.append(shape.part(j).y)

                        tempx = np.array(line_brow_x)
                        tempy = np.array(line_brow_y)
                        z1 = np.polyfit(tempx, tempy, 1)  
                        self.brow_k = -round(z1[0], 3) 
                        
                        brow_height = (brow_sum / 10) / self.face_width # 眉毛高度占比
                        brow_width = (frown_sum / 5) / self.face_width  # 眉毛距离占比

                        eye_sum = (shape.part(41).y - shape.part(37).y + shape.part(40).y - shape.part(38).y + 
                                   shape.part(47).y - shape.part(43).y + shape.part(46).y - shape.part(44).y)
                        eye_hight = (eye_sum / 4) / self.face_width
                        if round(mouth_height >= 0.03) and eye_hight<0.56:
                            cv2.putText(im_rd, "smile", (d.left(), d.bottom() + 20), cv2.FONT_HERSHEY_SIMPLEX, 2,
                                            (0,255,0), 2, 4)

                        if round(mouth_height<0.03) and self.brow_k>-0.3:
                            cv2.putText(im_rd, "unsmile", (d.left(), d.bottom() + 20), cv2.FONT_HERSHEY_SIMPLEX, 2,
                                        (0,255,0), 2, 4)
                cv2.putText(im_rd, "Face-" + str(len(faces)), (20,50), font, 0.6, (0,0,255), 1, cv2.LINE_AA)
            else:
                cv2.putText(im_rd, "No Face", (20,50), font, 0.6, (0,0,255), 1, cv2.LINE_AA)
            im_rd = cv2.putText(im_rd, "S: screenshot", (20,450), font, 0.6, (255,0,255), 1, cv2.LINE_AA)
            im_rd = cv2.putText(im_rd, "Q: quit", (20,470), font, 0.6, (255,0,255), 1, cv2.LINE_AA)
            if (cv2.waitKey(1) & 0xFF) == ord('s'):
                self.cnt += 1
                cv2.imwrite("screenshoot" + str(self.cnt) + ".jpg", im_rd)
            # 按下 q 键退出
            if (cv2.waitKey(1)) == ord('q'):
                break
            # 窗口显示
            cv2.imshow("Face Recognition", im_rd)
        self.cap.release()
        cv2.destroyAllWindows()
if __name__ == "__main__":
    my_face = face_emotion()
    my_face.learning_face()

运行结果:

在这里插入图片描述



参考

Python人脸识别微笑检测

Python-人脸识别并判断表情 笑脸或非笑脸 使用笑脸数据集genki4k

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Python 人脸表情识别 的相关文章

  • 2d 图像点和 3d 网格之间的交点

    Given 网格 源相机 我有内在和外在参数 图像坐标 2d Output 3D 点 是从相机中心发出的光线穿过图像平面上的 2d 点与网格的交点 我试图找到网格上的 3d 点 This is the process From Multip
  • 通过 boto3 承担 IAM 用户角色时访问被拒绝

    Issue 我有一个 IAM 用户和一个 IAM 角色 我正在尝试将 IAM 用户配置为有权使用 STS 承担 IAM 角色 我不确定为什么收到 访问被拒绝 错误 Details IAM 角色 arn aws iam 123456789 r
  • 将 yerr/xerr 绘制为阴影区域而不是误差线

    在 matplotlib 中 如何将误差绘制为阴影区域而不是误差条 例如 而不是 忽略示例图中各点之间的平滑插值 这需要进行一些手动插值 或者只是获得更高分辨率的数据 您可以使用pyplot fill between https matpl
  • 如何删除 PyCharm 中的项目?

    如果我关闭一个项目 然后删除该项目文件夹 则在 PyCharm 重新启动后 会再次创建一个空的项目文件夹 只需按顺序执行以下步骤即可 他们假设您当前在 PyCharm 窗口中打开了该项目 单击 文件 gt 关闭项目 关闭项目 在 PyCha
  • 如何在python中附加两个字节?

    说你有b x04 and b x00 你如何将它们组合起来b x0400 使用Python 3 gt gt gt a b x04 gt gt gt b b x00 gt gt gt a b b x04 x00
  • 如何调整 matplotlib 单选按钮的大小和纵横比?

    我已经尝试了几个小时来使简单的单选按钮列表的大小和纵横比正确 但没有成功 首先 导入模块 import matplotlib pyplot as plt from matplotlib widgets import RadioButtons
  • 如何获取numpy.random.choice的索引? - Python

    是否可以修改 numpy random choice 函数以使其返回所选元素的索引 基本上 我想创建一个列表并随机选择元素而不进行替换 import numpy as np gt gt gt a 1 4 1 3 3 2 1 4 gt gt
  • 使用 Pytest 的参数化添加测试功能的描述

    当其中一个测试失败时 可以在测试正在测试的内容的参数化中添加描述 快速了解测试失败的原因 有时您不知道测试失败的原因 您必须查看代码 通过每个测试的描述 您就可以知道 例如 pytest mark parametrize num1 num2
  • 以类型化内存视图作为成员的结构定义

    目前我正在尝试让一个具有类型化内存视图的结构能够工作 例如 ctypedef struct node unsigned int inds 如果 inds 不是内存视图 据我所知 它可以完美地工作 然而 通过内存视图并使用类似的东西 def
  • numpy:高效执行数组的复杂重塑

    我正在将供应商提供的大型二进制数组读入 2D numpy 数组 tempfid M N load data data numpy fromfile file dirname fid dtype numpy dtype i4 convert
  • OpenCV 跟踪器:模型未在函数 init 中初始化

    在视频的第一帧 我运行一个对象检测器 它返回对象的边界框 如下所示
  • 如何使用 opencv python 计算乐高积木上的孔数?

    我正在开发我的 python 项目 我需要计算每个乐高积木组件中有多少个孔 我将从输入 json 文件中获取有关需要计算哪个程序集的信息 如下所示 img 001 red 0 blue 2 white 1 grey 1 yellow 1 r
  • PIL.Image.open和tf.image.decode_jpeg返回值的区别

    我使用 PIL Image open 和 tf image decode jpeg 将图像文件解析为数组 但发现PIL Image open 中的像素值与tf image decode jpeg不一样 为什么会出现这种情况 Thanks 代
  • 为什么在Python解释器中输入_会返回True? [复制]

    这个问题在这里已经有答案了 我的翻译行为非常奇怪 gt gt gt True gt gt gt type True
  • App Engine 实体到字典

    将 google app engine 实体 在 python 中 复制到字典对象的好方法是什么 我正在使用 db Expando 对象 所有属性均为扩展属性 Thanks 有一个名为foo尝试 foo dict
  • 使用seaborn绘制简单线图

    我正在尝试使用seaborn python 绘制ROC曲线 对于 matplotlib 我只需使用该函数plot plt plot one minus specificity sensitivity bs where one minus s
  • 如何在 Seaborn 中的热图轴上表达类

    我使用 Seaborn 创建了一个非常简单的热图 显示相似性方阵 这是我使用的一行代码 sns heatmap sim mat linewidths 0 square True robust True sns plt show 这是我得到的
  • 为正则表达式编写解析器

    即使经过多年的编程 我很羞愧地说我从未真正完全掌握正则表达式 一般来说 当问题需要正则表达式时 我通常可以 在一堆引用语法之后 想出一个合适的正则表达式 但我发现自己越来越频繁地使用这种技术 所以 自学并理解正则表达式properly 我决
  • 仅允许正小数

    在我的 Django 模型中 我创建了一个如下所示的小数字段 price models DecimalField u Price decimal places 2 max digits 12 显然 价格为负或零是没有意义的 有没有办法将小数
  • 非法指令:MacOS High Sierra 上有 4 条指令

    我正在尝试在 pygame 3 6 中制作一个看起来像聊天的窗口 我刚刚将我的 MacBook 更新到版本 10 13 6 在我这样做之前它工作得很好 但在我收到消息之后 非法指令 4 Code import pygame from pyg

随机推荐

  • 【docker】CMD ENTRYPOINT 区别 终极解读!

    昨天用Dockerfile来启动mongodb的集群 启动参数 replSet死活没执行 最后就决定研究一哈cmd和entrypoint 但是上网看了一些资料个人觉得讲的不好 还是没有说出根本的东西 决定自己研究并且整理一哈 首先上dock
  • Linux系统下使用socat将串口映射到TCP服务器端口

    首先需要安装socat 安装方法即是 apt get install socat 或 yum install socat 然后使用以下命令进行映射 socat TCP LISTEN 8899 fork reuseaddr FILE dev
  • 华为OD机试 - 可以组成网络的服务器(Java)

    题目描述 在一个机房中 服务器的位置标识在 n m 的整数矩阵网格中 1 表示单元格上有服务器 0 表示没有 如果两台服务器位于同一行或者同一列中紧邻的位置 则认为它们之间可以组成一个局域网 请你统计机房中最大的局域网包含的服务器个数 输入
  • Java进阶知识

    今天分享有关java方面的知识 Paradigm 除了Java语言基础 通常在每种语言中还有很多paradigm 这些paradigm往往是衡量老鸟和新手的地方 比如函数命名 异常处理 泛型等等 下面用异常处理的两种类型来说明 笔者见过很多
  • JVM知识点

    JVM知识点 概念 java内存模型 线程私有 内存溢出和内存泄漏 线程共享区域 存在GC 类加载 类加载机制 双亲委派模型 垃圾回收GC 概念 如何判断一个对象是垃圾 有两种算法 1 引用计数算法 2 可达性分析算法 JVM采取 垃圾回收
  • 最大连续子序列和,以及开始、结束下标(Java)

    对一个有n个元素的数组 求最大的连续子数组的和 并求其开始 结束下标 数组的元素必然有正数也有负数才有意义 如果全是正数 那最大的子数组就是本身 如果全部为负数 那最大子数组就是空数组 例如下面的数组 其最大子数组序列和为187 子数组为X
  • k8s之nginx-ingress做tcp或udp的4层网络负载

    检查nginx ingress是否开启tcp udp转发 test test02 ingress kubectl get pod n ingress nginx o yaml grep i configmap configmap POD N
  • SpringBoot多数据源配置

    Druid 可以说是国内使用最广泛的数据源连接池产品
  • 华为校招机试题-MVP争夺战-2023年

    题目描述 在星球争霸篮球赛对抗赛中 强大的宇宙战队 希望每个人都能拿到MVP MVP的条件是 单场最高分得分获得者 可以并列 所以宇宙战队决定在比赛中 尽可能让更多的队员上场 且让所有有得分的队员得分都相同 然而比赛过程中的每一分钟的得分都
  • jsvc

    boltapp localhost apphome home boltapp apphome jsvc help Usage jsvc options class args Where options include help help s
  • python自动生成编号

    model 编号自增字段 class Bh BaseModel key models CharField null True max length 128 verbose name 唯一值 db index True unique True
  • 前端获取本地ip地址

    在某些场合的情况下 后台可能需要前端电脑的ip 因为每台电脑的ip不一样 所有需要动态获取 翻翻网上写的很多 里面其实是很坑的 因为都是在调用闭包函数 所以执行起来是没有任何问题的 但是 你页面想拿的时候 你是没法拿到的 下面就一vue 为
  • Ubuntu18.04 谷歌浏览器安装教程

    Ubuntu 经验笔记 Ubuntu18 04 谷歌浏览器安装教程 1 测试环境 2 安装步骤 Ubuntu18 04 谷歌浏览器安装教程 1 测试环境 系统版本 Ubuntu 18 04 安装时间 2021年7月4日 2 安装步骤 启动终
  • 区块链学习笔记(八)——应用之有机大米的一生

    区块链学习笔记 八 应用之有机大米的一生 前言 一 张三申请加入村里合作社的有机大米农业区块链项目 二 大米种植全程上链 三 有机大米收获出售过程上链 总结 前言 其实区块链的现实应用很多 我们用有机大米种植销售为例来看看它的应用 麻将四人
  • 设备怎样开启位置服务器,开启设备服务器

    开启设备服务器 内容精选 换一换 使用远程登录方式连接登录Windows云服务器时出现如下错误 此计算机无法连接到远程计算机 服务端安全组3389端口未开启 检查云服务器端口配置 服务端防火墙关闭 检查防火墙配置是否正常远程桌面连接配置不正
  • BMP存储方式

    BMP存储像素值的方式为从下至上 从左至右 紧随着文件头存储的字节为图像最下一行的数值 从左下角开始依次存储 22 22 22 23 为图像左下角像素的数值 依次向右存储 最后一行扫描完后 紧接着存储上一行 最后一个byte存储的是图像右上
  • Java中位数

    中位数 输入数组长度n 和n个数 输出这n个数的中位数 当结果为小数时向下取整 输入用例 1 1 输出用例 1 输入用例 2 3 3 输出用例 3 输入用例 5 5 3 1 2 4 输出用例 3 import java util Scann
  • 【ESP-IDF】2.ESP32C3移植u8g2显示库驱动OLED

    前言 这个系列的文章属于是为了一碟醋包了一顿饺子系列 起因是看到tb上某家店的ESP32C3开发板才9 9包邮 想着研究一下 把手头有个用Arduino UNO实现的项目升级一下 于是就有了这个系列 ESP32C3的简介 2020 年末 乐
  • React Navigation(三)-StackActions(API)

    原文链接 StackActions对象包含了生成特定actions的方法 即基于栈导航器的actions 这些方法扩展了NavigationActions 支持以下actions Reset 用一个新的状态替换当前状态 Replace 用其
  • Python 人脸表情识别

    人脸表情识别 一 图片预处理 二 数据集划分 三 识别笑脸 四 Dlib提取人脸特征识别笑脸和非笑脸 参考 环境搭建可查看Python人脸识别微笑检测 数据集可在https inc ucsd edu mplab wordpress inde