永生机械斗臂焊接件异常情况检测算法开发

zbc 0be4b5a819 -update: version beta1.0 4 miesięcy temu
.github 366b97be93 Initial commit 1 rok temu
data 0be4b5a819 -update: version beta1.0 4 miesięcy temu
docs 2d9643d596 hotfix: fix matching bug 1 rok temu
notebooks 2d9643d596 hotfix: fix matching bug 1 rok temu
scripts 366b97be93 Initial commit 1 rok temu
superpoint_superglue_deployment 0be4b5a819 -update: version beta1.0 4 miesięcy temu
tests 366b97be93 Initial commit 1 rok temu
.flake8 366b97be93 Initial commit 1 rok temu
.gitignore 366b97be93 Initial commit 1 rok temu
.pre-commit-config.yaml 366b97be93 Initial commit 1 rok temu
MANIFEST.in 366b97be93 Initial commit 1 rok temu
README.md 2d9643d596 hotfix: fix matching bug 1 rok temu
count_env.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
demo.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
demo_env.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
environment.yml 366b97be93 Initial commit 1 rok temu
generate_test_images.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
image-stitching.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
image_match_demo.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
image_similarity_count.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
params.yml 0be4b5a819 -update: version beta1.0 4 miesięcy temu
pyproject.toml 366b97be93 Initial commit 1 rok temu
read.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
requirements-dev.txt 366b97be93 Initial commit 1 rok temu
requirements.txt 366b97be93 Initial commit 1 rok temu
rorate_image_detection.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
setup.cfg 366b97be93 Initial commit 1 rok temu
setup.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
small_image_match.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu
test.py 0be4b5a819 -update: version beta1.0 4 miesięcy temu

README.md

Build Status

📝 simple library to make life easy when deploying superpoint, superglue models


:gear: Installation


pip install superpoint_superglue_deployment

:tada: TODO


  • interface to deploy superpoint, superglue
  • testing on real data

:running: How to Run


Basic usage

import cv2
import numpy as np
from loguru import logger

from superpoint_superglue_deployment import Matcher


def main():
    query_image = cv2.imread("./data/images/one_pillar_pagoda_1.jpg")
    ref_image = cv2.imread("./data/images/one_pillar_pagoda_2.jpg")

    query_gray = cv2.imread("./data/images/one_pillar_pagoda_1.jpg", 0)
    ref_gray = cv2.imread("./data/images/one_pillar_pagoda_2.jpg", 0)

    superglue_matcher = Matcher(
        {
            "superpoint": {
                "input_shape": (-1, -1),
                "keypoint_threshold": 0.003,
            },
            "superglue": {
                "match_threshold": 0.5,
            },
            "use_gpu": True,
        }
    )
    query_kpts, ref_kpts, _, _, matches = superglue_matcher.match(query_gray, ref_gray)
    M, mask = cv2.findHomography(
        np.float64([query_kpts[m.queryIdx].pt for m in matches]).reshape(-1, 1, 2),
        np.float64([ref_kpts[m.trainIdx].pt for m in matches]).reshape(-1, 1, 2),
        method=cv2.USAC_MAGSAC,
        ransacReprojThreshold=5.0,
        maxIters=10000,
        confidence=0.95,
    )
    logger.info(f"number of inliers: {mask.sum()}")
    matches = np.array(matches)[np.all(mask > 0, axis=1)]
    matches = sorted(matches, key=lambda match: match.distance)
    matched_image = cv2.drawMatches(
        query_image,
        query_kpts,
        ref_image,
        ref_kpts,
        matches[:50],
        None,
        flags=2,
    )
    cv2.imwrite("matched_image.jpg", matched_image)


if __name__ == "__main__":
    main()

matched image sample

match_two_images --query_path [path/to/query/image] --ref_path [path/to/reference/image] --use_gpu

🎛 Development environment


mamba env create --file environment.yml
mamba activate superpoint_superglue_deployment

:gem: References