PYTHON,OSError:[WinError 193]%1不是有效的Win32应用程序

时间:2018-08-04 15:30:07

标签: python machine-learning svm moviepy yolo

我正在使用yolo进行车辆检测和车道检测的项目,但是在执行代码时会发生此错误。

Loading complete!
Traceback (most recent call last):
File "main.py", line 47, in <module>
clip1 = VideoFileClip('examples/1.mp4').subclip(30,32)
File "C:\Users\Hrishikesh\Anaconda3\lib\site- 
 packages\moviepy\video\io\VideoFileClip.py", line 91, in __init__
fps_source=fps_source)
File "C:\Users\Hrishikesh\Anaconda3\lib\site- 
packages\moviepy\video\io\ffmpeg_reader.py", line 33, in __init__
fps_source)
File "C:\Users\Hrishikesh\Anaconda3\lib\site- 
packages\moviepy\video\io\ffmpeg_reader.py", line 256, in ffmpeg_parse_infos
proc = sp.Popen(cmd, **popen_params)
File "C:\Users\Hrishikesh\Anaconda3\lib\subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "C:\Users\Hrishikesh\Anaconda3\lib\subprocess.py", line 957, in 
_execute_childstartupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

以下代码成功执行了demo == 1的图像文件,但没有执行demo == 2和demo == 3(其中输入是视频文件)的图像文件。 o如何解决这个问题?

程序代码:

from moviepy.editor import VideoFileClip
from svm_pipeline import *
from yolo_pipeline import *
from lane import *



def pipeline_yolo(img):

img_undist, img_lane_augmented, lane_info = lane_process(img)
output = vehicle_detection_yolo(img_undist, img_lane_augmented, lane_info)

return output

def pipeline_svm(img):

img_undist, img_lane_augmented, lane_info = lane_process(img)
output = vehicle_detection_svm(img_undist, img_lane_augmented, lane_info)

return output


if __name__ == "__main__":

demo = 2  # 1:image (YOLO and SVM), 2: video (YOLO Pipeline), 3: video (SVM pipeline)

if demo == 1:
    filename = 'examples/test4.jpg'
    image = mpimg.imread(filename)

    #(1) Yolo pipeline
    yolo_result = pipeline_yolo(image)
    plt.figure()
    plt.imshow(yolo_result)
    plt.title('yolo pipeline', fontsize=30)

    #(2) SVM pipeline
    draw_img = pipeline_svm(image)
    fig = plt.figure()
    plt.imshow(draw_img)
    plt.title('svm pipeline', fontsize=30)
    plt.show()

elif demo == 2:
    # YOLO Pipeline
    video_output = 'examples/project_svm.mp4'
    clip1 = VideoFileClip('examples/1.mp4').subclip(30,32)
    clip = clip1.fl_image(pipeline_yolo)
    clip.write_videofile(video_output, audio=False)

else:
    # SVM pipeline
    video_output = 'examples/project_svm.mp4'
    clip1 = VideoFileClip("examples/project_video.mp4").subclip(30,32)
    clip = clip1.fl_image(pipeline_svm)
    clip.write_videofile(video_output, audio=False)

0 个答案:

没有答案