Fix loading dll error in vector_search

pull/966/head
gaotingquan 2021-06-24 07:30:53 +00:00
parent 46ee630bd3
commit 6458d5cf3b
3 changed files with 10 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import paddle
import numpy.ctypeslib as ctl
import numpy as np
import os
import sys
import json
import platform
@ -24,13 +25,19 @@ from ctypes import *
from numpy.ctypeslib import ndpointer
__dir__ = os.path.dirname(os.path.abspath(__file__))
winmode = None
if platform.system() == "Windows":
lib_filename = "index.dll"
if sys.version_info.minor >= 8:
winmode = 0x8
else:
lib_filename = "index.so"
so_path = os.path.join(__dir__, lib_filename)
try:
lib = ctypes.cdll.LoadLibrary(so_path)
if winmode is not None:
lib = ctypes.CDLL(so_path, winmode=winmode)
else:
lib = ctypes.CDLL(so_path)
except Exception as ex:
readme_path = os.path.join(__dir__, "README.md")
print(

View File

@ -87,6 +87,7 @@ wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/infere
# 下载识别inference模型并解压
wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/product_ResNet50_vd_aliproduct_v1.0_infer.tar && tar -xf product_ResNet50_vd_aliproduct_v1.0_infer.tar
cd ../
# 下载demo数据并解压
wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/recognition_demo_data_v1.0.tar && tar -xf recognition_demo_data_v1.0.tar
```

View File

@ -1,6 +1,6 @@
prettytable
ujson
opencv-python==4.1.2.30
opencv-python==4.4.0.46
pillow
tqdm
PyYAML