随笔分类 -  Python

摘要:```python import sys import faiss import numpy as np d = 64 nb = 100 nq = 10 np.random.seed(1234) xb = np.random.random((nb,d)).astype('float32') prin 阅读全文
posted @ 2023-07-05 15:28 不能说的秘密 阅读(76) 评论(0) 推荐(0) 编辑
摘要:import cv2 import numpy as np from skimage.metrics import structural_similarity import imutils def image_similarity(img1, img2): """ :param img1: 图片1 阅读全文
posted @ 2023-02-01 15:42 不能说的秘密 阅读(847) 评论(0) 推荐(0) 编辑
摘要:[[index, index + len(value) - 1] for index in [_.start() for _ in re.finditer(value, corrected_text)]] 阅读全文
posted @ 2023-01-29 14:41 不能说的秘密 阅读(21) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*-# import threading import time from queue import Queue def do(name): print(name) time.sleep(0.1) def task(name): if not message 阅读全文
posted @ 2023-01-09 16:25 不能说的秘密 阅读(38) 评论(0) 推荐(0) 编辑
摘要:import shutil from pathlib import Path from traceback import format_exc from log_color.log_color import Logger from progress.bar import IncrementalBar 阅读全文
posted @ 2022-12-28 16:38 不能说的秘密 阅读(499) 评论(0) 推荐(0) 编辑
摘要:wav2pcm import numpy as np def wav2pcm(wav_file, pcm_file, data_type=np.int16): f = open(wav_file, "rb") f.seek(0) f.read(44) data = np.fromfile(f, dt 阅读全文
posted @ 2022-12-23 10:55 不能说的秘密 阅读(57) 评论(0) 推荐(0) 编辑
摘要:from difflib import SequenceMatcher def text_similar_rate(text1, text2): """ :param text1: 文本1 :param text2: 文本2 :return: 相似度 """ return SequenceMatch 阅读全文
posted @ 2022-10-28 17:20 不能说的秘密 阅读(57) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*-# class Point: def __init__(self, xy): self.x = xy[0] self.y = xy[1] def line_intersection(line1, line2): """ :param line1: 线段一 阅读全文
posted @ 2022-09-27 15:55 不能说的秘密 阅读(254) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示