From 5ae52addd9ecc50782bc7aaa21d4c711d58a592b Mon Sep 17 00:00:00 2001 From: Arun Ponnusamy Date: Tue, 18 Sep 2018 20:02:54 +0530 Subject: [PATCH] Fix resource access issue on Windows --- cvlib/face_detection.py | 9 +++++---- setup.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cvlib/face_detection.py b/cvlib/face_detection.py index 09f0c2c..c3b28a3 100644 --- a/cvlib/face_detection.py +++ b/cvlib/face_detection.py @@ -5,7 +5,7 @@ import cv2 import numpy as np import os -import pkg_resources +from pkg_resources import resource_filename, Requirement def detect_face(image, threshold=0.5): @@ -14,9 +14,10 @@ def detect_face(image, threshold=0.5): return None # access resource files inside package - prototxt = pkg_resources.resource_filename(__name__, os.path.sep + 'data' + os.path.sep + 'deploy.prototxt') - caffemodel = pkg_resources.resource_filename(__name__, - os.path.sep + 'data' + os.path.sep + 'res10_300x300_ssd_iter_140000.caffemodel') + prototxt = resource_filename(Requirement.parse('cvlib'), + 'cvlib' + os.path.sep + 'data' + os.path.sep + 'deploy.prototxt') + caffemodel = resource_filename(Requirement.parse('cvlib'), + 'cvlib' + os.path.sep + 'data' + os.path.sep + 'res10_300x300_ssd_iter_140000.caffemodel') # read pre-trained wieights net = cv2.dnn.readNetFromCaffe(prototxt, caffemodel) diff --git a/setup.py b/setup.py index f542da4..9b33965 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,11 @@ from setuptools import setup setup(name='cvlib', - version='0.1.3', + version='0.1.5', description='A high level, easy to use, open source computer vision library for python', url='https://github.com/arunponnusamy/cvlib.git', author='Arun Ponnusamy', - author_email='arunponnusamy93@gmail.com', + author_email='hello@arunponnusamy.com', license='MIT', packages=['cvlib'], include_package_data=True,