You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.
#194
Open
HardikJain02 opened this issue
Jun 25, 2023
· 3 comments
· May be fixed by #214
I crash into this error while executing
python test.py --trained_model=craft_mlt_25k.pth --refiner_model=craft_refiner_CTW1500.pth --test_folder=myfolder --refine
Traceback (most recent call last):
File "C:\code\CRAFT-pytorch\test.py", line 165, in
bboxes, polys, score_text = test_net(net, image, args.text_threshold, args.link_threshold, args.low_text, args.cuda, args.poly, refine_net)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\code\CRAFT-pytorch\test.py", line 106, in test_net
polys = craft_utils.adjustResultCoordinates(polys, ratio_w, ratio_h)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\code\CRAFT-pytorch\craft_utils.py", line 251, in adjustResultCoordinates
polys = np.array(polys)
^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.
The text was updated successfully, but these errors were encountered:
def adjustResultCoordinates(polys, ratio_w, ratio_h, ratio_net=2): if len(polys) > 0: for k in range(len(polys)): if polys[k] is not None: polys[k] *= np.array([ratio_w * ratio_net, ratio_h * ratio_net]) return polys
def adjustResultCoordinates(polys, ratio_w, ratio_h, ratio_net=2): if len(polys) > 0: polys_filtered = [poly for poly in polys if poly is not None] # Added Line polys = np.array(polys_filtered) for k in range(len(polys)): if polys[k] is not None: polys[k] *= (ratio_w * ratio_net, ratio_h * ratio_net) return polys
Replace the above code in site-packages\craft_text_detector\craft_utils.py to solve the inhomogeneous array problem.
eshan1347
added a commit
to eshan1347/CRAFT-pytorch
that referenced
this issue
Oct 4, 2024
I crash into this error while executing
python test.py --trained_model=craft_mlt_25k.pth --refiner_model=craft_refiner_CTW1500.pth --test_folder=myfolder --refine
Traceback (most recent call last):
File "C:\code\CRAFT-pytorch\test.py", line 165, in
bboxes, polys, score_text = test_net(net, image, args.text_threshold, args.link_threshold, args.low_text, args.cuda, args.poly, refine_net)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\code\CRAFT-pytorch\test.py", line 106, in test_net
polys = craft_utils.adjustResultCoordinates(polys, ratio_w, ratio_h)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\code\CRAFT-pytorch\craft_utils.py", line 251, in adjustResultCoordinates
polys = np.array(polys)
^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.
The text was updated successfully, but these errors were encountered: