小工具

#def download(url) -> np.array:
def download(url):
    while True:
        res = requests.get(url).content
        return cv2.imdecode(np.fromstring(res, np.uint8), cv2.IMREAD_COLOR).tolist() # bgr

 

def compute_distance(a, b):

    return np.dot(a, b.T) / (np.linalg.norm(a) * np.linalg.norm(b))

posted @ 2023-03-13 11:35  singyoutosleep  阅读(26)  评论(0)    收藏  举报