简体   繁体   English

是否存在对图像进行归一化的GStreamer过滤器?

[英]Is there a GStreamer filter that does normalization on an image?

I'm trying to create a GStreamer pipeline that can do image processing. 我正在尝试创建一个可以进行图像处理的GStreamer管道。 Specifically, I'm doing image pre-processing to be used by machine learning networks. 具体来说,我正在做图像预处理以供机器学习网络使用。 So this pipeline will do all the necessary pre-processing steps before it is fed to the neural network. 因此,在将其馈送到神经网络之前,该管道将执行所有必要的预处理步骤。
Right now, I'm trying to figure out if there are any GStreamer plugins that can simply do normalization. 现在,我试图找出是否有任何可以简单地进行标准化的GStreamer插件。
GStreamer does allow programmers to create custom plugins for applications. GStreamer确实允许程序员为应用程序创建自定义插件。 This is one solution to this question, but I want to find out if there are any pre-existing solutions. 这是解决此问题的一种方法,但我想了解是否存在任何预先存在的解决方案。

Anything might help!!! 可能有什么帮助!!! Thank you in advance. 先感谢您。

I've looked into GStreamers list of plugins on their website but there are a lot and some descriptions aren't clear, to me, what they do or how to use them. 我已经在他们网站上查看了GStreamers插件列表,但是对我来说,它们的作用或使用方法尚不清楚。
This page is a list of GStreamers plugins provided on their website. 页面是其网站上提供的GStreamers插件的列表。

This plugin sounded promising but isn't quite what I was looking for. 这个插件听起来很有前途,但并不是我想要的。

If anyone is curious, this is the normalization method that I want to replicate for my GStreamer pipeline. 如果有人好奇,这是我要为我的GStreamer管道复制的规范化方法。

def preprocess(img_data):
    mean_vec = np.array([0.485, 0.456, 0.406])
    stddev_vec = np.array([0.229, 0.224, 0.225])
    norm_img_data = np.zeros(img_data.shape).astype('float32')
    for i in range(img_data.shape[0]):  
         # for each pixel in each channel, divide the value by 255 to get value between [0, 1] and then normalize
        norm_img_data[i,:,:] = (img_data[i,:,:]/255 - mean_vec[i]) / stddev_vec[i]
    return norm_img_data

When we use normalization on images for neural network inferences, we usually do: 当我们在图像上使用归一化进行神经网络推断时,通常会执行以下操作:

${some video/x-raw stream} ! tensor_converter ! tensor_transform mode=arithmetic option=typecast:float32,add:-127.5,div:127.6 ! tensor_filter ${whatever neural network mode you want} ! .... 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM