AnimatedDrawings icon indicating copy to clipboard operation
AnimatedDrawings copied to clipboard

run my own image error @ /examples/image_to_annotations.py

Open xiaowangsmile opened this issue 1 year ago • 11 comments

Hi, when I tried to run my own image by setting up the container and following the tutorial below, it shows an error message. Here is the error message:

$ python image_to_animation.py drawings/garlic.png garlic_out
Traceback (most recent call last):
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 39, in <module>
    image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 17, in image_to_animation
    image_to_annotations(img_fn, char_anno_dir)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_annotations.py", line 50, in image_to_annotations
    detection_results = json.loads(resp.content)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Python's version:3.9.2 os version win11 home How should I solve the problem? Thanks!

xiaowangsmile avatar Apr 18 '23 05:04 xiaowangsmile

Hello,

I haven't tested this on Windows 11, that may be a source of the problem. But it looks like the response from the torchserve inside the docker container isn't in the format that's being expected. There's probably some sort of error there.

Can you inspect or print the contents of resp directly before the line in which the error occurs detection_results = json.loads(resp.content)?

hjessmith avatar Apr 19 '23 18:04 hjessmith

Tengo el mismo problema :(

Chezenia avatar Apr 20 '23 17:04 Chezenia

Same thing happened, MacBook Pro Max, M2, run everything as readme.md

animated_drawings) user@usermbp examples % python image_to_animation.py drawings/garlic.png garlic_out
Traceback (most recent call last):
  File "image_to_animation.py", line 41, in <module>
    image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn)
  File "image_to_animation.py", line 19, in image_to_animation
    image_to_annotations(img_fn, char_anno_dir)
  File "/Users/user/work/python/AnimatedDrawings/examples/image_to_annotations.py", line 52, in image_to_annotations
    detection_results = json.loads(resp.content)
  File "/Users/user/miniconda3/envs/animated_drawings/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/Users/user/miniconda3/envs/animated_drawings/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/user/miniconda3/envs/animated_drawings/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

jiangyan avatar Apr 21 '23 10:04 jiangyan

你好,当我尝试通过设置容器并按照下面的教程运行我自己的图像时,它显示了一条错误消息。 这是错误消息:

$ python image_to_animation.py drawings/garlic.png garlic_out
Traceback (most recent call last):
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 39, in <module>
    image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 17, in image_to_animation
    image_to_annotations(img_fn, char_anno_dir)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_annotations.py", line 50, in image_to_annotations
    detection_results = json.loads(resp.content)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Python版本:3.9.2 os version win11 home 请问应该怎么解决? 谢谢!

hello are you resolve this question?can you help me to teach that how can you run the project on windows 10. i tried to run in win 10 ,but when i run the docker container i got a question that i cant access to connect the torch server when i curl localhost:8080 always response is a empty server looking forward to your reply thanks!

dhs964057117 avatar Apr 23 '23 04:04 dhs964057117

你好,当我尝试通过设置容器并按照下面的教程运行我自己的图像时,它显示了一条错误消息。 这是错误消息:

$ python image_to_animation.py drawings/garlic.png garlic_out
Traceback (most recent call last):
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 39, in <module>
    image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 17, in image_to_animation
    image_to_annotations(img_fn, char_anno_dir)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_annotations.py", line 50, in image_to_annotations
    detection_results = json.loads(resp.content)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Python版本:3.9.2 os version win11 home 请问应该怎么解决? 谢谢!

hello are you resolve this question?can you help me to teach that how can you run the project on windows 10. i tried to run in win 10 ,but when i run the docker container i got a question that i cant access to connect the torch server when i curl localhost:8080 always response is a empty server looking forward to your reply thanks!

I haven't solved this problem yet

xiaowangsmile avatar Apr 23 '23 04:04 xiaowangsmile

你好,当我尝试通过设置容器并按照下面的教程运行我自己的图像时,它显示了一条错误消息。 这是错误消息:

$ python image_to_animation.py drawings/garlic.png garlic_out
Traceback (most recent call last):
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 39, in <module>
    image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 17, in image_to_animation
    image_to_annotations(img_fn, char_anno_dir)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_annotations.py", line 50, in image_to_annotations
    detection_results = json.loads(resp.content)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Python版本:3.9.2 os version win11 home 请问应该怎么解决? 谢谢!

hello are you resolve this question?can you help me to teach that how can you run the project on windows 10. i tried to run in win 10 ,but when i run the docker container i got a question that i cant access to connect the torch server when i curl localhost:8080 always response is a empty server looking forward to your reply thanks!

I haven't solved this problem yet

i m troubled by the previous step that when i curl localhost:8080/ping and i always got is empty server but i maybe have a suggestion your error log is reported by the origin code line: resp = requests.post("http://localhost:8080/predictions/drawn_humanoid_pose_estimator", files=data_file, verify=False) pose_results = json.loads(resp.content) maybe you should debug here or add log here to analysis,If the problem is that different systems cause inconsistent return data formats ,Perhaps you can reformat the data yourself to resolve it for example: resp = requests.post("http://localhost:8080/predictions/drawn_humanoid_pose_estimator", files=data_file, verify=False) reformatData = reformat(resp.content) pose_results = json.loads(reformatData)

dhs964057117 avatar Apr 23 '23 04:04 dhs964057117

I haven't tried to run this code on windows myself, and so don't have great insight into likely causes of your problems.

But there is clearly an issue with the torchserver inside of your docker. Try using macos or ubuntu 18.04 for this project if that is an option for you.

hjessmith avatar Apr 24 '23 04:04 hjessmith

image I've encountered the same problem,win10 home system

yxf1213 avatar Apr 27 '23 03:04 yxf1213

Can you guys show the messages you get from torchserve? That could help a lot to narrow down what is the cause. Try to see the log file in your docker container if you could see some errors there.

thhung avatar Apr 27 '23 19:04 thhung

(animated_drawings) C:\Users\user\AnimatedDrawings\examples>python image_to_animation.py drawings/garlic.png garlic_out Traceback (most recent call last): File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "", line 3, in raise_from File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "C:\Users\user\miniconda3\envs\animated_drawings\lib\http\client.py", line 1375, in getresponse response.begin() File "C:\Users\user\miniconda3\envs\animated_drawings\lib\http\client.py", line 318, in begin version, status, reason = self._read_status() File "C:\Users\user\miniconda3\envs\animated_drawings\lib\http\client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\util\retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\packages\six.py", line 769, in reraise raise value.with_traceback(tb) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "", line 3, in raise_from File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\urllib3\connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "C:\Users\user\miniconda3\envs\animated_drawings\lib\http\client.py", line 1375, in getresponse response.begin() File "C:\Users\user\miniconda3\envs\animated_drawings\lib\http\client.py", line 318, in begin version, status, reason = self._read_status() File "C:\Users\user\miniconda3\envs\animated_drawings\lib\http\client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\user\AnimatedDrawings\examples\image_to_animation.py", line 41, in image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn) File "C:\Users\user\AnimatedDrawings\examples\image_to_animation.py", line 19, in image_to_animation image_to_annotations(img_fn, char_anno_dir) File "C:\Users\user\AnimatedDrawings\examples\image_to_annotations.py", line 51, in image_to_annotations resp = requests.post("http://localhost:8080/predictions/drawn_humanoid_detector", files=request_data, verify=False) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\requests\api.py", line 115, in post return request("post", url, data=data, json=json, **kwargs) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\requests\sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "C:\Users\user\miniconda3\envs\animated_drawings\lib\site-packages\requests\adapters.py", line 547, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

I am using windows 10 and Python 3.10.10

***After reinstall python 3.8.13 the problem was fixed !

pingfai avatar May 09 '23 05:05 pingfai

Hi, when I tried to run my own image by setting up the container and following the tutorial below, it shows an error message. Here is the error message:

$ python image_to_animation.py drawings/garlic.png garlic_out
Traceback (most recent call last):
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 39, in <module>
    image_to_animation(img_fn, char_anno_dir, motion_cfg_fn, retarget_cfg_fn)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_animation.py", line 17, in image_to_animation
    image_to_annotations(img_fn, char_anno_dir)
  File "F:\animate\AnimatedDrawings-0.0.1\examples\image_to_annotations.py", line 50, in image_to_annotations
    detection_results = json.loads(resp.content)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\zhuxulu\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Python's version:3.9.2 os version win11 home How should I solve the problem? Thanks! Try install python 3.8.13

pingfai avatar May 10 '23 01:05 pingfai