这个错误发生原因是因为图片的尺寸与weight 不匹配,不能做乘积,所以需要改变图片尺寸。
使用如下代码:img = cv2.resize(img, (448, 448))
加在img = cv2.resize(img, (448, 448)) img = cv2.cvtColor(img, cv2.COLOR_RGB2RGBA) x_offset = y_offset = 0 y1, y2 = y_offset, y_offset + image.shape[0] x1, x2 = x_offset, x_offset + image.shape[1]
这里
类似错误:
h大小: 224w大小: 224mesh形状: (448, 448)image形状: (448, 448)image大小: (448, 448, 4)img大小: (224, 224, 4)Traceback (most recent call last):File "trimesh_renderer.py", line 124, in <module>visualize(renderer, original_img, params, vertices, cam, joints)File "/Users/elaine/Desktop/hmr2/src/notebooks/vis_util.py", line 162, in visualizeimg_overlay = renderer(vert_shifted, img=img, bg_color=np.array((255.0, 255.0, 255.0, 1)))File "trimesh_renderer.py", line 63, in __call__img[y1:y2, x1:x2, c] = (alpha_mesh * image[:, :, c] + alpha_image,img[y1:y2, x1:x2, c])ValueError: could not broadcast input array from shape (2) into shape (224,224)