Hi,
I am quite new in this topic and I have tried to execute the code of the following link:
https://github.com/priya-dwivedi/Deep-Learning/blob/master/Object_Detection_Tensorflow_API.ipynb
The detection of objects in the images does not give any problem. The error appears when executing the following line of code:
% time white_clip.write_videofile (white_output1, audio = False)
It is interrupted at 12%.
The error code is as follows:
Moviepy - Building video video1_out.mp4.
Moviepy - Writing video video1_out.mp4
t: 12%|█▏ | 6/50 [00:37<04:37, 6.30s/it, now=None]
ValueError Traceback (most recent call last)
in
<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-176> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in requires_duration(f, clip, *a, **k)
52 raise ValueError("Attribute 'duration' not set")
53 else:
---> 54 return f(clip, *a, **k)
55
56
<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-175> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in use_clip_fps_by_default(f, clip, *a, **k)
135 for (k,v) in k.items()}
136
--> 137 return f(clip, *new_a, **new_kw)
<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-174> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in convert_masks_to_RGB(f, clip, *a, **k)
20 if clip.ismask:
21 clip = clip.to_RGB()
---> 22 return f(clip, *a, **k)
23
24 @decorator.decorator
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\video\VideoClip.py in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)
324 verbose=verbose, threads=threads,
325 ffmpeg_params=ffmpeg_params,
--> 326 logger=logger)
327
328 if remove_temp and make_audio:
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in ffmpeg_write_video(clip, filename, fps, codec, bitrate, preset, withmask, write_logfile, audiofile, verbose, threads, ffmpeg_params, logger)
214
215 for t,frame in clip.iter_frames(logger=logger, with_times=True,
--> 216 fps=fps, dtype="uint8"):
217 if withmask:
218 mask = (255*clip.mask.get_frame(t))
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\Clip.py in iter_frames(self, fps, with_times, logger, dtype)
473 logger = proglog.default_bar_logger(logger)
474 for t in logger.iter_bar(t=np.arange(0, self.duration, 1.0/fps)):
--> 475 frame = self.get_frame(t)
476 if (dtype is not None) and (frame.dtype != dtype):
477 frame = frame.astype(dtype)
<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-135> in get_frame(self, t)
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in wrapper(f, *a, **kw)
87 new_kw = {k: fun(v) if k in varnames else v
88 for (k,v) in kw.items()}
---> 89 return f(*new_a, **new_kw)
90 return decorator.decorator(wrapper)
91
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\Clip.py in get_frame(self, t)
93 return frame
94 else:
---> 95 return self.make_frame(t)
96
97 def fl(self, fun, apply_to=None, keep_duration=True):
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\Clip.py in (t)
136
137 #mf = copy(self.make_frame)
--> 138 newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
139
140 if not keep_duration:
~\Anaconda3\envs\tfg\lib\site-packages\moviepy\video\VideoClip.py in (gf, t)
509 if apply_to is None:
510 apply_to = []
--> 511 return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
512
513 # --------------------------------------------------------------
in process_image(image)
4 with detection_graph.as_default():
5 with tf.Session(graph=detection_graph) as sess:
----> 6 image_process = detect_objects(image, sess, detection_graph)
7 return image_process
in detect_objects(image_np, sess, detection_graph)
26 category_index,
27 use_normalized_coordinates=True,
---> 28 line_thickness=8)
29 return image_np
~\Anaconda3\envs\tfg\Lib\site-packages\tensorflow\models\research\object_detection\utils\visualization_utils.py in visualize_boxes_and_labels_on_image_array(image, boxes, classes, scores, category_index, instance_masks, instance_boundaries, keypoints, use_normalized_coordinates, max_boxes_to_draw, min_score_thresh, agnostic_mode, line_thickness, groundtruth_box_visualization_color, skip_scores, skip_labels)
742 thickness=line_thickness,
743 display_str_list=box_to_display_str_map[box],
--> 744 use_normalized_coordinates=use_normalized_coordinates)
745 if keypoints is not None:
746 draw_keypoints_on_image_array(
~\Anaconda3\envs\tfg\Lib\site-packages\tensorflow\models\research\object_detection\utils\visualization_utils.py in draw_bounding_box_on_image_array(image, ymin, xmin, ymax, xmax, color, thickness, display_str_list, use_normalized_coordinates)
127 thickness, display_str_list,
128 use_normalized_coordinates)
--> 129 np.copyto(image, np.array(image_pil))
130
131
ValueError: assignment destination is read-only
Can you help me?