Skip to content

Commit

Permalink
Fix resource access issue on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
arunponnusamy committed Sep 18, 2018
1 parent 2ddd67e commit 5ae52ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cvlib/face_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 5ae52ad

Please sign in to comment.