LostPetInitiative / Calvin_Zhirui_Yolo5_head_detector

Docker image of the service that applies YoloV5 trained by Calvin and Zhirui to detect animal heads and bodies.
MIT License
0 stars 0 forks source link

im.transpose((1, 2, 0)) axes don't match array #5

Open dgrechka opened 2 years ago

dgrechka commented 2 years ago
Got job pet911ru_rf434618
pet911ru_rf434618: Starting to process the job
pet911ru_rf434618: Extracting 1 images
Traceback (most recent call last):
  File "/mnt/ssd/yolo5_zirui_calvin/code/serve.py", line 35, in <module>
    work()
  File "/mnt/ssd/yolo5_zirui_calvin/code/serve.py", line 29, in work
    out_job, uid = process_job(model, job)
  File "/mnt/ssd/yolo5_zirui_calvin/code/infer.py", line 65, in process_job
    yolo5_outputs = infer_in_json_field(model, images)
  File "/mnt/ssd/yolo5_zirui_calvin/code/infer.py", line 33, in infer_in_json_field
    head, annotated, heads_count = detect_head_and_body(model, imNumpy)
  File "/mnt/ssd/yolo5_zirui_calvin/code/model.py", line 10, in detect_head_and_body
    pred = model(img)
  File "/mnt/ssd/yolo5_zirui_calvin/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
    return forward_call(*input, **kwargs)
  File "/mnt/ssd/yolo5_zirui_calvin/venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/mnt/ssd/yolo5_zirui_calvin/code/./yolov5/models/common.py", line 587, in forward
    im = im.transpose((1, 2, 0))  # reverse dataloader .transpose(2, 0, 1)
ValueError: axes don't match array
Closing the Kafka producer with 0 secs timeout.
Proceeding to force close the producer since pending requests could not be completed within timeout 0.
Stopping heartbeat thread
dgrechka commented 2 years ago

752423.jpg: GIF image data, version 87a, 400 x 534

import imageio a = imageio.imread('752423.gif')

:1: DeprecationWarning: Starting with ImageIO v3 the behavior of this function will switch to that of iio.v3.imread. To keep the current behavior (and make this warning dissapear) use `import imageio.v2 as imageio` or call `imageio.v2.imread` directly. a.shape (534, 400, 4)