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
save_subtitles_to_file(input_file_path, output_file_path, lang=language_code,
time_start=start_time, time_end=end_time,
conf_threshold=confidence_threshold, sim_threshold=similarity_threshold,
use_gpu=use_gpu,
# # Models different from the default mobile models can be downloaded here: https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.3/doc/doc_en/models_list_en.md
det_model_dir='./videocr/model/ch_det_fast', rec_model_dir='./videocr/model/ch_rec_fast',
# brightness_threshold=210, similar_image_threshold=1000 # filters might help
# use_fullframe=True, # note: videocr just assumes horizontal lines of text. vertical text scenario hasn't been implemented yet
frames_to_skip=frames_to_skip, # can skip inference for some frames to speed up the process
crop_x=crop_x, crop_y=crop_y, crop_width=crop_width, crop_height=crop_height)`
报错:
`---------------------------------------------------------------------------
error Traceback (most recent call last)
/tmp/ipykernel_8898/783819912.py in
25 # use_fullframe=True, # note: videocr just assumes horizontal lines of text. vertical text scenario hasn't been implemented yet
26 frames_to_skip=frames_to_skip, # can skip inference for some frames to speed up the process
---> 27 crop_x=crop_x, crop_y=crop_y, crop_width=crop_width, crop_height=crop_height)
`from videocr import save_subtitles_to_file
#@title OCR parameters
input_file_path = "example_cropped.mp4" #@param {type:"string"}
output_file_path = "example.srt" #@param {type:"string"}
language_code = "ch" #@param {type:"string"}
use_gpu = False #@param {type:"boolean"}
start_time = "00:00" #@param {type:"string"}
end_time = "" #@param {type:"string"}
confidence_threshold = 50 #@param {type:"number"}
similarity_threshold = 80 #@param {type:"number"}
frames_to_skip = 0 #@param {type:"integer"}
crop_x = 40 #@param {type:"integer"}
crop_y = 650 #@param {type:"integer"}
crop_width = 890 #@param {type:"integer"}
crop_height = 69 #@param {type:"integer"}
save_subtitles_to_file(input_file_path, output_file_path, lang=language_code,
time_start=start_time, time_end=end_time,
conf_threshold=confidence_threshold, sim_threshold=similarity_threshold,
use_gpu=use_gpu,
# # Models different from the default mobile models can be downloaded here: https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.3/doc/doc_en/models_list_en.md
det_model_dir='./videocr/model/ch_det_fast', rec_model_dir='./videocr/model/ch_rec_fast',
# brightness_threshold=210, similar_image_threshold=1000 # filters might help
# use_fullframe=True, # note: videocr just assumes horizontal lines of text. vertical text scenario hasn't been implemented yet
frames_to_skip=frames_to_skip, # can skip inference for some frames to speed up the process
crop_x=crop_x, crop_y=crop_y, crop_width=crop_width, crop_height=crop_height)`
报错:
`---------------------------------------------------------------------------
error Traceback (most recent call last)
/tmp/ipykernel_8898/783819912.py in
25 # use_fullframe=True, # note: videocr just assumes horizontal lines of text. vertical text scenario hasn't been implemented yet
26 frames_to_skip=frames_to_skip, # can skip inference for some frames to speed up the process
---> 27 crop_x=crop_x, crop_y=crop_y, crop_width=crop_width, crop_height=crop_height)
~/work/y00580163/videocr-PaddleOCR/videocr/api.py in save_subtitles_to_file(video_path, file_path, lang, time_start, time_end, conf_threshold, sim_threshold, use_fullframe, det_model_dir, rec_model_dir, use_gpu, brightness_threshold, similar_image_threshold, similar_pixel_threshold, frames_to_skip, crop_x, crop_y, crop_width, crop_height)
23 f.write(get_subtitles(
24 video_path, lang, time_start, time_end, conf_threshold,
---> 25 sim_threshold, use_fullframe, det_model_dir, rec_model_dir, use_gpu, brightness_threshold, similar_image_threshold, similar_pixel_threshold, frames_to_skip, crop_x, crop_y, crop_width, crop_height))
~/work/y00580163/videocr-PaddleOCR/videocr/api.py in get_subtitles(video_path, lang, time_start, time_end, conf_threshold, sim_threshold, use_fullframe, det_model_dir, rec_model_dir, use_gpu, brightness_threshold, similar_image_threshold, similar_pixel_threshold, frames_to_skip, crop_x, crop_y, crop_width, crop_height)
10
11 v = Video(video_path, det_model_dir, rec_model_dir)
---> 12 v.run_ocr(use_gpu, lang, time_start, time_end, conf_threshold, use_fullframe, brightness_threshold, similar_image_threshold, similar_pixel_threshold, frames_to_skip, crop_x, crop_y, crop_width, crop_height)
13 return v.get_subtitles(sim_threshold)
14
~/work/y00580163/videocr-PaddleOCR/videocr/video.py in run_ocr(self, use_gpu, lang, time_start, time_end, conf_threshold, use_fullframe, brightness_threshold, similar_image_threshold, similar_pixel_threshold, frames_to_skip, crop_x, crop_y, crop_width, crop_height)
74
75 if similar_image_threshold:
---> 76 grey = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
77 if prev_grey is not None:
78 _, absdiff = cv2.threshold(cv2.absdiff(prev_grey, grey), similar_pixel_threshold, 255, cv2.THRESH_BINARY)
error: OpenCV(4.6.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'`
The text was updated successfully, but these errors were encountered: