Jigsaw-VAD icon indicating copy to clipboard operation
Jigsaw-VAD copied to clipboard

gen_patches.py

Open 35454652 opened this issue 2 years ago • 4 comments

Hello, I processed the data set according to the steps you gave, but I came across the following problem. Could you please tell me the specific reason?

Load 194 videos 157179 frames, 82144 objects, in 0.14162135124206543 s. 0%| | 0/82144 [00:00<?, ?it/s] Traceback (most recent call last): File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 185, in frame_num=args.sample_num) File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 64, in init self.save_objects() File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 91, in save_objects obj = self.get_object(record["video_name"], record["frame"], record["object"]) File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 112, in get_object img = self.get_frame(video_name, frame) File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 122, in get_frame img = self.read_frame_data(video_dir, frame, frame_list) File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 153, in read_frame_data img = self.read_single_frame(video_dir, frame + f, frame_list) File "D:/python/pycharm/Jigsaw-VAD-main/gen_patches.py", line 139, in read_single_frame "The frame {} is out of the range:{}.".format(int(frame), len(frame_list)) ValueError: invalid literal for int() with base 10: '000004.jpg'

35454652 avatar Dec 18 '22 04:12 35454652

@35454652 You may check the correct dataset you downloaded. It seems that the dataset you used has different numbers of frames or objects. You could check https://github.com/gdwang08/Jigsaw-VAD/issues/2 for reference.

gdwang08 avatar Dec 25 '22 04:12 gdwang08

Hi @gdwang08 ,

Thank you for your excellent work. Currently, I try processed the data set according to the steps you gave. The code worked well, but when it ran to object 12695/79988 that failed. Could you please tell me the specific reason?

/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD Load 21 videos 15324 frames, 79988 objects, in 0.2845275402069092 s. 16% 12695/79988 [06:10<32:43, 34.27it/s] Traceback (most recent call last): File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 181, in shanghai_dataset = VideoAnomalyDataset(data_dir=data_dir + args.dataset + '/' + args.phase + 'ing/frames', File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 64, in init self.save_objects() File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 91, in save_objects obj = self.get_object(record["video_name"], record["frame"], record["object"]) File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 112, in get_object img = self.get_frame(video_name, frame) File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 122, in get_frame img = self.read_frame_data(video_dir, frame, frame_list) File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 153, in read_frame_data img = self.read_single_frame(video_dir, frame + f, frame_list) File "/content/drive/MyDrive/Anomrly_Detection/Jigsaw-VAD/Jigsaw-VAD/gen_patches.py", line 139, in read_single_frame "The frame {} is out of the range:{}.".format(int(frame), len(frame_list)) ValueError: invalid literal for int() with base 10: '0000.jpg'

harveyzoka avatar Mar 26 '23 19:03 harveyzoka

@harveyzoka It seems that you do not have '0000.jpg', you may doule check your dataset directory. In case of incomplete Avenue dataset, I have uploaded a copy of the dataset I used for your reference. Hope it helps!

gdwang08 avatar Mar 27 '23 02:03 gdwang08

Hi, @harveyzoka Have you solved this problem? I also encountered the same problem. About “ValueError: invalid literal for int() with base 10: '0000.jpg'”

wanlong111 avatar Oct 07 '23 07:10 wanlong111