TransNetV2 icon indicating copy to clipboard operation
TransNetV2 copied to clipboard

PIL error

Open SIAK-q opened this issue 2 years ago • 3 comments

hello, I'm running consolidate_datasets.py and got these errors, could you please tell me what cause them? Thank you sooo much. File "/Users/z/Desktop/transnetv2/consolidate_datasets.py", line 215, in clipshots_dataset(CLIPSHOTS_TRN_txt_files, CLIPSHOTS_TRN_mp4_files, CLIPSHOTS_TRN_target_dir) File "/Users/z/Desktop/transnetv2/consolidate_datasets.py", line 208, in clipshots_dataset visualize_scenes(video, scenes).save(save_to + ".png") File "/Users/z/Desktop/transnetv2/visualization_utils.py", line 55, in visualize_scenes draw_end_frame(end) File "/Users/z/Desktop/transnetv2/visualization_utils.py", line 33, in draw_end_frame draw.rectangle([(w * iw + iw - 1, h * ih), (w * iw + iw - 3, h * ih + ih - 1)], fill=(255, 0, 0)) File "/Users/z/opt/anaconda3/lib/python3.9/site-packages/PIL/ImageDraw.py", line 292, in rectangle self.draw.draw_rectangle(xy, fill, 1) ValueError: x1 must be greater than or equal to x0

SIAK-q avatar Jan 18 '24 16:01 SIAK-q

Hi,have you solved this problem?

DarcyFan avatar Sep 12 '24 06:09 DarcyFan

Same issue, was this solved?

segalinc avatar Jan 14 '25 16:01 segalinc

I encountered the same issue when processing the dataset, I swapped the rectangle's parameter (x0, x1), and it worked.

def draw_end_frame(frame_no):
        w = frame_no % width
        h = frame_no // width
        draw.rectangle([(w * iw + iw - 3, h * ih), (w * iw + iw - 1, h * ih + ih - 1)], fill=(255, 0, 0))
        draw.polygon([(w * iw + iw - 8, h * ih + ih // 2 - 4), (w * iw + iw - 13, h * ih + ih // 2),
                    (w * iw + iw - 8, h * ih + ih // 2 + 4)], fill=(255, 0, 0))
        draw.rectangle([(w * iw + iw - 8, h * ih + ih // 2 - 1), (w * iw + iw - 1, h * ih + ih // 2 + 1)],
                    fill=(255, 0, 0))

Also, comment the visualize_scenes(video, scenes).save(save_to + ".png") may also be fine

hangingter avatar Feb 28 '25 10:02 hangingter