ipazc / vrpwrp

VRPWRP (Vision-algorithms Requests Processing Wrappers), a pip package for running deep-learning Computer Vision algorithms from the cloud.
MIT License
7 stars 5 forks source link

JSONDecodeError #4

Open waqarws opened 6 years ago

waqarws commented 6 years ago

Running this piece of code:

face_detection = FaceDetection()
frame = cv2.imread('image_file.jpg')
bounding_boxes = face_detection.analyze_pil(Image.fromarray(frame))  

Gives the following error (JSONDecodeError: Expecting value: line 1 column 1 (char 0)):

File "C:/Users/wsarguroh001/Downloads/Powai_Rainbow_Cropped.py", line 69, in <module>
    bounding_boxes = face_detection.analyze_pil(Image.fromarray(frame))
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\vrpwrp\wrappers\face_detection.py", line 100, in analyze_pil
    return self.analyze_bytes(image_bytes)
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\vrpwrp\wrappers\face_detection.py", line 48, in analyze_bytes
    response = self._request("PUT", data=image_bytes, is_binary=True)['bounding_boxes']
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\vrpwrp\wrappers\APIWrapper.py", line 27, in _request
    return response.json()
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\simplejson\__init__.py", line 517, in loads
    return _default_decoder.decode(s)
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\simplejson\decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\simplejson\scanner.py", line 79, in scan_once
    return _scan_once(string, idx)
  File "C:\Users\wsarguroh001\AppData\Local\Continuum\anaconda3\lib\site-packages\simplejson\scanner.py", line 70, in _scan_once
    raise JSONDecodeError(errmsg, string, idx)
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It used to work just fine earlier. Also it works alright on another system but throws this error on mine. Tried uninstalling and reinstalling the wrapper but to no effect.

ipazc commented 6 years ago

Please, can you post your OS and Python versions? I couldn't reproduce the error.

You might be having connectivity issues with the backend. In order to confirm this, can you please execute this script from scratch and print here the result?

from vrpwrp.wrappers.face_detection import FaceDetection
import requests
detector = FaceDetection()
image = requests.get("https://raw.githubusercontent.com/ipazc/mtcnn/master/ivan.jpg").content

print(detector.analyze_bytes(image))