BabitMF / bmf

Cross-platform, customizable multimedia/video processing framework. With strong GPU acceleration, heterogeneous design, multi-language support, easy to use, multi-framework compatible and high performance, the framework is ideal for transcoding, AI inference, algorithm integration, live video streaming, and more.
https://babitmf.github.io/
Apache License 2.0
809 stars 71 forks source link

Core dumped due to floating point exception #137

Closed meet-soni5720 closed 1 week ago

meet-soni5720 commented 1 month ago

I am creating new module for video segmentation, and while converting the processed output from model (numpy array) to videoFrame, the process terminates with floating point exception:

Floating point exception (core dumped)

code part: [followed from colorization demo] rgbinfo = mp.PixelInfo(mp.PixelFormat.kPF_RGB24)

annotated_frame = np.array(annotated_frame) print(f"annotated frame: {annotated_frame}") np_op = mp.from_numpy(annotated_frame) out_f = mp.Frame(np_op, rgbinfo) out_vf = VideoFrame(out_f) out_vf.pts = in_frame.pts out_vf.time_base = in_frame.time_base out_pkt = Packet(out_vf)

output: annotated frame: [[[ 7 9 11] [ 8 10 12] [ 9 11 13] ... [ 5 7 6] [ 4 6 5] [ 4 6 5]]

[[ 7 9 11] [ 8 10 12] [ 9 11 13] ... [ 6 8 8] [ 5 7 6] [ 5 7 6]]

[[ 7 9 11] [ 8 10 12] [ 9 11 13] ... [ 8 11 10] [ 7 9 9] [ 7 9 9]]

...

[[14 16 20] [15 17 21] [16 18 22] ... [13 11 11] [12 9 10] [12 9 10]]

[[13 15 19] [14 16 20] [15 17 21] ... [13 11 11] [12 9 10] [12 9 10]]

[[12 14 18] [13 15 19] [14 16 20] ... [12 9 10] [12 9 10] [12 9 10]]]

Floating point exception (core dumped)

This happens on line: np_op = mp.from_numpy(annotated_frame)

BMF version: BabitMF-GPU==0.0.11

CUDA : 12.1

ffmpeg version:

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

taoboyang commented 1 month ago

Hi, I would like to know what versions of python and numpy are installed in your machine environment?

import numpy
numpy.__version__
meet-soni5720 commented 1 month ago

Hi, numpy version in my system is 2.1.2, and the Python version is 3.10.15.

taoboyang commented 4 weeks ago

I think it should be a mismatch of numpy, could you try this command to install numpy 1, and try again?

pip install numpy==1.26.4
meet-soni5720 commented 4 weeks ago

The issue is resolved after updating numpy to 1.26.4, working fine now; Thank you!