机器学习

接触yolo那会 对图像识别  感兴趣

学习pytorch 先看了numpy 

然后写了个 机器学习入门

1.手写数字

2. 猫狗训练

3.lstm+cbc 不定长

 4.孪生网络 

学会了 模型迁移 欠拟合 过拟合怎么处理 

研究下下面网站 验证码很全

import cv2
import numpy as np

def load_image(path):
    image = cv2.imread(path)
    if image is None:
        print(f"Error: Unable to load image at path {path}")
    return image

# img1 = load_image('top.jpg')
img1 = load_image('Capimg/10.jpg')
img1 = img1[0:100,]
img2 = load_image('left2.jpeg')
img2 = img2[0:100,]

if img1 is None or img2 is None:
    # 终止程序或进行错误处理
    print("Image loading failed, terminating program.")
else:
    orb = cv2.ORB_create(nfeatures=1500)
    kp1, des1 = orb.detectAndCompute(img1, None)
    kp2, des2 = orb.detectAndCompute(img2, None)

    if des1 is None or des2 is None:
        print("No descriptors found in one or both images.")
    else:
        # 确保描述符是正确的类型
        if des1.dtype != np.float32:
            des1 = des1.astype(np.float32)
        if des2.dtype != np.float32:
            des2 = des2.astype(np.float32)

        # 创建BFMatcher对象
        bf = cv2.BFMatcher(cv2.NORM_L2, crossCheck=True)

        # 进行匹配
        matches = bf.match(des1, des2)
        matches = sorted(matches, key=lambda x: x.distance)

        # 绘制前10个匹配项
        img3 = cv2.drawMatches(img1, kp1, img2, kp2, matches[:10], None, flags=2)

        cv2.imshow("Matches", img3)
        cv2.waitKey(0)
        cv2.destroyAllWindows()
Opencv

 

 思路 opencv 

 pytorch 

 

 这种分类任务 cnn来说太简单了

 这种的话 还是分类任务 本想着 切八张小图,写个乱序 让机器识别 没整出来 ,可能是模型没写好把

 

 

ok的 

posted @ 2024-05-19 07:58  inks  阅读(25)  评论(0)    收藏  举报