当前位置: 首页 > news >正文

网站域名com和cn产品宣传

网站域名com和cn,产品宣传,做网站的公司违约怎么处理,wordpress本地调试慢这次给老铁们带来的是京东手势验证码的识别。 目标网站:https://plogin.m.jd.com/mreg/index 验证码如下图: 当第一眼看到这个验证码的时候,就头大了,这玩意咋识别??? 静下心来细想后的一个方案&#xf…

这次给老铁们带来的是京东手势验证码的识别。

目标网站:https://plogin.m.jd.com/mreg/index

验证码如下图:

图片

当第一眼看到这个验证码的时候,就头大了,这玩意咋识别???

静下心来细想后的一个方案,就是直接用yolo的目标检测去硬刚,方案如下:

根据曲线的特征,提取较特殊的

  • 起末点(1)
  • 转折点(2)
  • 相较点(3)

进行打标提取几个点的位置,然后根据曲线斜率和长度的关系进行连接,得到曲线的轨迹,但是这种我感觉成功率可能不会很高,就没有试了,不过肯定也是可行的,感兴趣的可以自行尝试哈。

图片

图片

于是我便寻找下一种方案,辗转反侧,夜不能寐,终于看到一篇文章介绍了

yolo8-pose姿态检测模型

图片

可以通过目标图关键点实现骨架连接,那么同理我们的手势曲线,也可利用关键点检测实现轨迹连接。

图片

话不多说直接开干

yolo8仓库地址:https://github.com/ultralytics/ultralytics

然后下载labelme标注软件,图片可存放在ultralytics目录下新建的imgs文件夹。

yolo8-pose 需要进行目标框选和关键点匹配,进行如下形式的标注,

这里一开始的关键点我只用了4个,训练出来的效果极差,后面加到了10个相对好很多。

图片

打标完成后会生成json文件,我们要转换成yolo可以识别txt文件

这里需要注意这些参数

  • class_list 是你框选的名称
  • keypoint_list 是关键点名称,要按顺序来,不然连接的时候会乱
  • img_list = glob.glob(“imgs/*.png”) 图片加载路径

# -*-coding:utf-8 -*-"""
# File       : labelme_to_yolo.py
# Time       : 2024/5/8 16:40
# Author     : 阿J
# version    : 2024
# Description: 
"""
# 将labelme标注的json文件转为yolo格式
import cv2
import glob
import json
import tqdm# 物体类别class_list = ["box"]
# 关键点的顺序
keypoint_list = ["1",'11','22', "2",'33','44', "3",'55','66', "4"]def json_to_yolo(img_data, json_data):h, w = img_data.shape[:2]# 步骤:# 1. 找出所有的矩形,记录下矩形的坐标,以及对应group_id# 2. 遍历所有的head和tail,记下点的坐标,以及对应group_id,加入到对应的矩形中# 3. 转为yolo格式rectangles = {}# 遍历初始化for shape in json_data["shapes"]:label = shape["label"]  # pen, head, tailgroup_id = shape["group_id"]  # 0, 1, 2, ...points = shape["points"]  # x,y coordinatesshape_type = shape["shape_type"]# 只处理矩形,读矩形if shape_type == "rectangle":if group_id not in rectangles:rectangles[group_id] = {"label": label,"rect": points[0] + points[1],  # Rectangle [x1, y1, x2, y2]"keypoints_list": []}# 遍历更新,将点加入对应group_id的矩形中,读关键点,根据group_id匹配for keypoint in keypoint_list:for shape in json_data["shapes"]:label = shape["label"]group_id = shape["group_id"]points = shape["points"]# 如果匹配到了对应的keypointif label == keypoint:rectangles[group_id]["keypoints_list"].append(points[0])# else:#   rectangles[group_id]["keypoints_list"].append([0,0])# 转为yolo格式yolo_list = []for id, rectangle in rectangles.items():result_list = []if rectangle['label'] not in class_list:continuelabel_id = class_list.index(rectangle["label"])# x1,y1,x2,y2x1, y1, x2, y2 = rectangle["rect"]# center_x, center_y, width, heightcenter_x = (x1 + x2) / 2center_y = (y1 + y2) / 2width = abs(x1 - x2)height = abs(y1 - y2)# normalizecenter_x /= wcenter_y /= hwidth /= wheight /= h# 保留6位小数center_x = round(center_x, 6)center_y = round(center_y, 6)width = round(width, 6)height = round(height, 6)# 添加 label_id, center_x, center_y, width, heightresult_list = [label_id, center_x, center_y, width, height]# 添加 p1_x, p1_y, p1_v, p2_x, p2_y, p2_vfor point in rectangle["keypoints_list"]:x, y = pointx, y = int(x), int(y)x /= wy /= h# 保留2位小数x = round(x, 2)y = round(y, 2)result_list.extend([x, y, 2])# if len(rectangle["keypoints_list"]) == 4:#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])## if len(rectangle["keypoints_list"]) == 2:#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])#     result_list.extend([0, 0, 0])yolo_list.append(result_list)return yolo_listimport os
print(os.getcwd())
# 获取所有的图片
img_list = glob.glob("imgs/*.png")
for img_path in tqdm.tqdm(img_list):img = cv2.imread(img_path)print(img_path)json_file = img_path.replace('png', 'json')with open(json_file) as json_file:json_data = json.load(json_file)yolo_list = json_to_yolo(img, json_data)yolo_txt_path = img_path.replace('png', 'txt')with open(yolo_txt_path, "w") as f:for yolo in yolo_list:for i in range(len(yolo)):if i == 0:f.write(str(yolo[i]))else:f.write(" " + str(yolo[i]))f.write("\n")

执行上面的代码后就会生成txt文件
在这里插入图片描述
然后我们在ultralytics目录下的ultralytics/data新建images、labels文件夹,目录格式如下,然后对imges图片和labels标签(txt)进行分类即可
在这里插入图片描述
接着是修改yaml文件,如下图所示

在这里插入图片描述
当然还需要下载预训练模型yolov8s-pose.pt,在官网的这个位置

在这里插入图片描述
最后新建一个my_train.py文件,对应填入yaml、model的路径即可开始训练

# -*-coding:utf-8 -*-"""
# File       : my_train.py
# Time       : 2024/5/8 16:55
# Author     : 阿J
# version    : 2024
# Description: 
"""
#训练代码
from ultralytics import YOLO# Load a model
model = YOLO(r'E:\ultralytics-main\ultralytics\weight\yolov8s-pose.pt')# Train the model
results = model.train(data=r'E:\ultralytics-main\ultralytics\cfg\datasets\coco-pose.yaml', epochs=300, imgsz=320)# # 验证代码
# from ultralytics import YOLO
#
# # Load a model
# model = YOLO(r'E:\ultralytics-main\runs\pose\train4\weights\last.pt')
#
# # Val the model
# results = model.val(data=r'E:\ultralytics-main\ultralytics\cfg\datasets\coco-pose.yaml',imgsz=320,batch=6,workers=8)

左边是目标检测,右边是关键点检测(map50会慢慢上去)

在这里插入图片描述
训练好后,可以用上面的的验证代码进行验证一下,模型路径在runs\pose\train

打标图片

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

在这里插入图片描述

也可用以下代码进行推理


# -*-coding:utf-8 -*-"""
# File       : 推理.py
# Time       : 2024/5/8 17:59
# Author     : 阿J
# version    : 2024
# Description: 
"""
import io# 测试图片
from ultralytics import YOLO
import cv2
import numpy as np
import time# 读取命令行参数
# weight_path = r'E:\ultralytics-main\runs\pose\train4\weights\last.pt'
weight_path = 'best.pt'
# media_path = "img/1715153883102.png"
# media_path = "xxx.png"
media_path = "img.png"time1 = time.time()
# 加载模型
model = YOLO(weight_path)
print("模型加载时间:", time.time() - time1)
# 获取类别
objs_labels = model.names  # get class labels
# print(objs_labels)# 类别的颜色
class_color = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0),(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 255, 0),(255, 0, 0), (0, 255, 0)]
# 关键点的顺序
class_list = ["box"]# 关键点的颜色
keypoint_color = [(255, 0, 0), (0, 255, 0),(255, 0, 0), (0, 255, 0),(255, 0, 0), (0, 255, 0),(255, 0, 0), (0, 255, 0),(255, 0, 0), (0, 255, 0)]def cv2_imread_buffer(buffer):# 假设buffer是一个字节流对象buffer = io.BytesIO(buffer)# 将buffer转换为numpy数组arr = np.frombuffer(buffer.getvalue(), np.uint8)# 使用cv2.imdecode函数将numpy数组解码为图像img = cv2.imdecode(arr, cv2.IMREAD_COLOR)return imgdef pose_ocr(img):# 读取图片if isinstance(img,str):frame = cv2.imread(img)else:frame = cv2_imread_buffer(img)# frame = cv2.resize(frame, (280, 280))# 检测result = list(model(frame, conf=0.5, stream=True))[0]  # inference,如果stream=False,返回的是一个列表,如果stream=True,返回的是一个生成器boxes = result.boxes  # Boxes object for bbox outputsboxes = boxes.cpu().numpy()  # convert to numpy array# 遍历每个框for box in boxes.data:l, t, r, b = box[:4].astype(np.int32)  # left, top, right, bottomconf, id = box[4:]  # confidence, classid = int(id)# 绘制框cv2.rectangle(frame, (l, t), (r, b), (0, 0, 255), 1)# 绘制类别+置信度(格式:98.1%)cv2.putText(frame, f"{objs_labels[id]} {conf * 100:.1f}", (l, t - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5,(0, 0, 255), 2)# 遍历keypointskeypoints = result.keypoints  # Keypoints object for pose outputskeypoints = keypoints.cpu().numpy()  # convert to numpy arraypose_point = []# draw keypoints, set first keypoint is red, second is bluefor keypoint in keypoints.data:pose_point = [[round(x),round(y)] for x,y,c in keypoint]for i in range(len(keypoint)):x, y ,_ = keypoint[i]x, y = int(x), int(y)cv2.circle(frame, (x, y), 3, (0, 255, 0), -1)#cv2.putText(frame, f"{keypoint_list[i]}", (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 1, keypoint_color[i], 2)if len(keypoint) >= 2:# draw arrow line from tail to half between head and tailx0, y0 ,_= keypoint[0]x1, y1 ,_= keypoint[1]x2, y2 ,_= keypoint[2]x3, y3 ,_= keypoint[3]x4, y4 ,_= keypoint[4]x5, y5 ,_= keypoint[5]x6, y6 ,_= keypoint[6]x7, y7 ,_= keypoint[7]x8, y8 ,_= keypoint[8]x9, y9 ,_= keypoint[9]cv2.line(frame, (int(x0), int(y0)), (int(x1), int(y1)), (255, 0, 255), 5)cv2.line(frame, (int(x1), int(y1)), (int(x2), int(y2)), (255, 0, 255), 5)cv2.line(frame, (int(x2), int(y2)), (int(x3), int(y3)), (255, 0, 255), 5)cv2.line(frame, (int(x3), int(y3)), (int(x4), int(y4)), (255, 0, 255), 5)cv2.line(frame, (int(x4), int(y4)), (int(x5), int(y5)), (255, 0, 255), 5)cv2.line(frame, (int(x5), int(y5)), (int(x6), int(y6)), (255, 0, 255), 5)cv2.line(frame, (int(x6), int(y6)), (int(x7), int(y7)), (255, 0, 255), 5)cv2.line(frame, (int(x7), int(y7)), (int(x8), int(y8)), (255, 0, 255), 5)cv2.line(frame, (int(x8), int(y8)), (int(x9), int(y9)), (255, 0, 255), 5)#center_x, center_y = (x1 + x2) / 2, (y1 + y2) / 2# cv2.arrowedLine(frame, (int(x2), int(y2)), (int(center_x), int(center_y)), (255, 0, 255), 4,#                line_type=cv2.LINE_AA, tipLength=0.1)# save imagecv2.imwrite("result.jpg", frame)# print("save result.jpg")return pose_pointif __name__ == '__main__':img = './img.png'res = pose_ocr(img)print(res)

效果如下,输出的是关键点坐标

在这里插入图片描述
在这里插入图片描述
后面就是代入到验证码的识别验证接口,具体参数加密这里就不叙述,主要就是调wasm即可。

接下来讲的是如何实现这个曲线的轨迹,众所周知京东的轨迹是一向比较恶心的。

我用的方法是贝塞尔曲线的方式,通过对输入的坐标,实现一个轨迹的拟合效果。

在这里插入图片描述
经过一系列的参数调整,终于得到一个成功率相对可以的(60-80%)轨迹生成函数,弄的时候发现在转折点时,停留时间需长一点!

在这里插入图片描述
轨迹代码已上传星球,感兴趣的可以加一下哦!vx私聊我有优惠~

同时已建群,在外流浪的老铁私信我进群了(星球付费群),每天都会讨论各种技术问题(ali、tx、dx)等各种热门验证码~

wx:scorpio_a_j

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


文章转载自:
http://deputation.pfbx.cn
http://drooping.pfbx.cn
http://misspell.pfbx.cn
http://isocyanine.pfbx.cn
http://pretest.pfbx.cn
http://ovary.pfbx.cn
http://caffeic.pfbx.cn
http://perambulate.pfbx.cn
http://fervent.pfbx.cn
http://phycocyanin.pfbx.cn
http://sucrase.pfbx.cn
http://losing.pfbx.cn
http://priscan.pfbx.cn
http://previable.pfbx.cn
http://lensman.pfbx.cn
http://becrawl.pfbx.cn
http://netop.pfbx.cn
http://innovator.pfbx.cn
http://processive.pfbx.cn
http://ephod.pfbx.cn
http://undid.pfbx.cn
http://contrapposto.pfbx.cn
http://folderol.pfbx.cn
http://unexacting.pfbx.cn
http://jibuti.pfbx.cn
http://unpeople.pfbx.cn
http://unmuzzle.pfbx.cn
http://holster.pfbx.cn
http://collage.pfbx.cn
http://overtask.pfbx.cn
http://sulphamerazine.pfbx.cn
http://fucose.pfbx.cn
http://syntomycin.pfbx.cn
http://amphigamous.pfbx.cn
http://immunohistology.pfbx.cn
http://spirogram.pfbx.cn
http://brno.pfbx.cn
http://anyuan.pfbx.cn
http://toyman.pfbx.cn
http://hydromancer.pfbx.cn
http://unapprised.pfbx.cn
http://projection.pfbx.cn
http://dadaist.pfbx.cn
http://infertility.pfbx.cn
http://discordantly.pfbx.cn
http://microquake.pfbx.cn
http://intraday.pfbx.cn
http://worker.pfbx.cn
http://erlking.pfbx.cn
http://mukhtar.pfbx.cn
http://zahal.pfbx.cn
http://roadworthiness.pfbx.cn
http://hairtail.pfbx.cn
http://loader.pfbx.cn
http://numeracy.pfbx.cn
http://developable.pfbx.cn
http://batterie.pfbx.cn
http://satan.pfbx.cn
http://nerving.pfbx.cn
http://felt.pfbx.cn
http://semiglobular.pfbx.cn
http://cycle.pfbx.cn
http://gismo.pfbx.cn
http://salpiglossis.pfbx.cn
http://splenii.pfbx.cn
http://trimetallic.pfbx.cn
http://landman.pfbx.cn
http://platycephaly.pfbx.cn
http://reradiate.pfbx.cn
http://tinnitus.pfbx.cn
http://unexpanded.pfbx.cn
http://flaccid.pfbx.cn
http://backache.pfbx.cn
http://breeziness.pfbx.cn
http://skydive.pfbx.cn
http://apostle.pfbx.cn
http://finish.pfbx.cn
http://executancy.pfbx.cn
http://dolldom.pfbx.cn
http://confabulator.pfbx.cn
http://uninteresting.pfbx.cn
http://emptiness.pfbx.cn
http://entrance.pfbx.cn
http://noncarcinogenic.pfbx.cn
http://endwise.pfbx.cn
http://nympho.pfbx.cn
http://coacher.pfbx.cn
http://kcps.pfbx.cn
http://roughhewn.pfbx.cn
http://archfiend.pfbx.cn
http://macrocephali.pfbx.cn
http://pulverous.pfbx.cn
http://garlic.pfbx.cn
http://ultramicrochemistry.pfbx.cn
http://affirmably.pfbx.cn
http://corticous.pfbx.cn
http://voltaism.pfbx.cn
http://monoacidic.pfbx.cn
http://antiutopian.pfbx.cn
http://riflescope.pfbx.cn
http://www.15wanjia.com/news/103640.html

相关文章:

  • 如何做网站 写代码百度热度榜搜索趋势
  • 好模板网站宁波seo在线优化哪家好
  • 阜阳建设网站专业网站制作网站公司
  • 正规的丹阳网站建设百度健康
  • 如何给网站做优化seo关键词软件
  • 国外建站数据seo入门到精通
  • 如何做网站建设方案免费的编程自学网站
  • 深圳做购物网站图片在线转外链
  • 浙江怎样做网站女性广告
  • dedecms 做网站深圳网络营销推广
  • 专业做网站优化需要多久网站seo排名优化工具在线
  • 网站SEO容易做吗怎样在百度上免费建网站
  • 换ip对网站有影响吗今日热点新闻10条
  • 哪个网站不花钱可以做招聘写手接单平台
  • 网站优化软件排名技术百度账号客服
  • 武汉网站开发公司百度广告代运营公司
  • php 微网站开发上海疫情最新消息
  • 网页设计培训公司哪家好零基础学seo要多久
  • 搬家网站怎么做世界足球世界排名
  • 在线做分析图的网站百度云官网登录入口
  • 网站中图片中间是加号怎么做私人做网站建设
  • 备案网站百度网盘app下载安装手机版
  • 做女装的看哪个网站好seo图片优化的方法
  • 有域名如何做网站关键词工具软件
  • 怎么做企业官方网站网站优化的方法有哪些
  • wordpress标签导航网站做优化
  • 做网站的学校百度云服务器官网
  • 沂南网站开发线上营销的优势和劣势
  • 怎样办一个网站自媒体平台app
  • 做网站风险百度快照官网