Giter Site home page Giter Site logo

Comments (5)

littletomatodonkey avatar littletomatodonkey commented on September 12, 2024

您好,感谢您对PaddleClas的认可,数据去重这个过程,我们使用的是SIFT匹配去重的思路。具体地,主要有以下几个步骤

  1. 基于SIFT提取特征点
  2. 基于特征点,获取具有尺度和旋转不变性的特征向量
  3. 计算并比较22k数据集与imagenet1k 验证集中所有图片的特征向量相似度,设置合适的阈值,当相似度大于阈值时,说明图像相似,需要进行去重。

from paddleclas.

NextGuido avatar NextGuido commented on September 12, 2024

@littletomatodonkey 感谢回复, 我从网上找了一下相关的方法, 能帮我看一下这样处理的结果可以算作相似度吗?

`import cv2

class SiftMatch(object):

def __init__(self, thresh=.75):
    """
    :param thresh: 图片距离统计的阈值, 小于改阈值的才会被视为成功的匹配点
    """
    self.thresh = thresh
    self.sift = cv2.xfeatures2d.SIFT_create()
    # BFMatcher with default params
    self.bf = cv2.BFMatcher()

def calc_similarity(self, img1, img2):
    """
    计算相似度
    :param img1: 图片1, 灰度图
    :param img2: 图片2, 灰度图
    :return: 相似度
    """
    assert len(img1.shape) == len(img2.shape) == 2
    kp1, des1 = self.sift.detectAndCompute(img1, None)
    kp2, des2 = self.sift.detectAndCompute(img2, None)
    matches = self.bf.knnMatch(des1, des2, k=2)
    good = []
    for m, n in matches:
        if m.distance < self.thresh * n.distance:
            good.append([m])
    return len(good) / len(matches)

if name == 'main':
img1 = cv2.imread('./demo01.jpg', 0)
img2 = cv2.imread('./demo02.jpg', 0)

sift = SiftMatch()
sim = sift.calc_similarity(img1, img2)
print(sim)

`

from paddleclas.

littletomatodonkey avatar littletomatodonkey commented on September 12, 2024

您好,可以的,这个distance指的是两个特征向量之间的欧式距离,距离越小,表示越相似,也可以可以作为相似度的评估指标的

from paddleclas.

NextGuido avatar NextGuido commented on September 12, 2024

多谢答疑, 非常期待你们可以开源自己的去重方法, 也希望paddle的生态越来越完美

from paddleclas.

pawopawo avatar pawopawo commented on September 12, 2024

您好,感谢您对PaddleClas的认可,数据去重这个过程,我们使用的是SIFT匹配去重的思路。具体地,主要有以下几个步骤

  1. 基于SIFT提取特征点
  2. 基于特征点,获取具有尺度和旋转不变性的特征向量
  3. 计算并比较22k数据集与imagenet1k 验证集中所有图片的特征向量相似度,设置合适的阈值,当相似度大于阈值时,说明图像相似,需要进行去重。

请问设置合适的阈值,具体是设置为多少啊?

from paddleclas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.