This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM67A:单深度估算

Guru**** 2652575 points

Other Parts Discussed in Thread: AM67A

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1591002/am67a-monodepth-estimation

器件型号: AM67A
主题中讨论的其他器件: Midas

您好、
我正在尝试运行 运动恢复结构 (SFM) 应用 Edge AI 单色深度估算演示 但我遇到了几个问题。

  1. 运动应用程序中的结构 我的软件版本中缺失、我不知道如何在电路板上正确添加或安装它。

  2. 我要运行 Edge AI 单色深度估算演示 使用 自定义模型
    电路板正在运行 TIDL 11_00_06_00 我为生成了模型工件 DE-7310_Midas-small_onnx 消息流 ORST

  3. 当我尝试启动 GStreamer 流水线进行单深度估算演示时、即流水线 无法启动 。 这可能是由于不兼容、元件缺失或 TIDL 中模型集成不当造成的。

  4. 我的目标是 测试自定义单色深度估算模型并将其集成到 ROS 中 、因此我需要澄清:

    • 如何从运动应用程序中添加或构建结构(如果当前构建中未包含该结构);

    • 如何在 TIDL 11_00_06_00 上使用自定义模型正确运行边缘 AI 单深度估算演示;

    • 确保 GStreamer 流水线成功初始化和运行模型需要执行哪些步骤。

此致、
Andow

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Androw:  

    问得好。 一般来说、就我们在 SDK 中提供的开箱即用功能而言、单摄像头深度估算对 AM67A 的支持有限。 让我单独回答您的问题

    “[1]封装的一部分、仅在 TDA4x 处理器上受支持。 该软件是 PSDK RTOS 的一部分、也是 AM67A 固件构建器的一部分、但我要重申、AM67A、AM62A 等工业器件不包括 e2e 团队提供的 vision_apps 支持。  
    我要运行 Edge AI 单色深度估算演示 使用 自定义模型
    电路板正在运行 TIDL 11_00_06_00 我为生成了模型工件 DE-7310_Midas-small_onnx 消息流 ORST .

    好的、听起来至少已经编译好了。 请注意、我们支持对图像分类、物体检测、关键点检测(用于人体姿势)和语义/像素级分割进行后处理。 深度估计没有关联的后处理函数集

    当我尝试启动 GStreamer 流水线进行单深度估算演示时、即流水线 无法启动 。 这可能是由于不兼容、元件缺失或 TIDL 中模型集成不当而导致的。

    是的、这是预期的。 请参阅上述内容。 我们工具中的单深度估算不包括后处理实现。 这是由用户(您)实现的。 您可以使用 git repo 进行单声道深度估计[2]作为基准,虽然我只在 Python 中为 Midas 模型编写了这篇文章。 其他模型在后处理方面可能存在一些差异(例如,输出是深度与视差)

    [引述 userid=“676408" url="“ url="~“~/support/processors-group/processors/f/processors-forum/1591002/am67a-monodepth-estimation

    我的目标是 测试自定义单色深度估算模型并将其集成到 ROS 中 、因此我需要澄清:

    • 如何从运动应用程序中添加或构建结构(如果当前构建中未包含该结构);

    • 如何在 TIDL 11_00_06_00 上使用自定义模型正确运行边缘 AI 单深度估算演示;

    • 确保 GStreamer 流水线成功初始化和运行模型需要执行哪些步骤。

    [/报价]

    首先、建议使用 TDA4x SDK 从 Motion 应用程序中为此结构构建视觉应用程序。 这是一种立体视觉应用、而不是单声道应用。

    要运行该演示(我几年前开发的)、您需要在 run_demo.sh 脚本中至少更改模型路径。 如果这也是米达斯,如你所说,那么我希望这是变化的程度。 但是、将其整合到 edgeai-gst-apps [3]中需要您添加后处理函数以进行深度估算(在 python、cpp 或 tidlpostproc GStreamer 插件中(也是 cpp))

    在最后一点、这取决于您是否需要后处理。 如果您只想运行模型来检查它是否初始化并运行、但让结果消失在 void 或/dev/null 中、则可以使用 OptiFlow 构建流水线[4]。 生成的 GStreamer 字符串将包括一些后处理和可视化(到 HDMI 监视器,到文件,到网络等)。 您可以切掉 tidlinferer 插件之后的部分,以便模型和模型本身的输入管道运行,但此后没有特定的深度估计。  

    我可以在您需要的任何方向提供更多的信息 — 希望详细的响应是有帮助的。

    P.S。对于机器人、我们正在改变位置、因此建议使用 TDA4x 器件、尤其是在需要功能安全 (ASIL/SIL) 而不是 AM6xA 时。 AM67A 等效的是 TDA4AEN --它们是相似的设备、但有不同的软件。  

    [1] https://git.ti.com/cgit/processor-sdk/vision_apps

    [2] https://github.com/TexasInstruments/edgeai-gst-apps 

     [3] https://github.com/TexasInstruments-Sandbox/edgeai-demo-monodepth-estimation 

    [4] https://github.com/TexasInstruments/edgeai-gst-apps/tree/main/optiflow 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢您的详细说明—这对我非常有帮助。
    我现在的主要任务是仅使用单个摄像头即可获得深度估算值、因此 SFM 应用似乎不适合我的用例。

    因此、我当前的目标是运行 edgeai-demo-mo深度 估算

    关于后处理 — 我已经弄清楚了。 我创建了一个小型 ORST 处理程序、但我仍然希望能够使用视频流或实时摄像头测试流水线。

    现在,我有一个 网络摄像头 C170 、与 C270 相比、它的参数略有不同、因此我更新了的分辨率 USB-720p 在中。 gst_configs.py

    我还编译了 Midas 模型 可以使用的 TIDL 版本。

    在中更新摄像机和型号后run_demo.sh、我运行演示并得到以下问题:

    root@j722s-evm:/opt/app/edgeai-demo-monodepth-estimation# ./run_demo.sh 
    libtidl_onnxrt_EP loaded 0x182d3720 
    Final number of subgraphs created are : 1, - Offloaded Nodes - 84, Total Nodes - 84 
    APP: Init ... !!!
       107.149544 s: MEM: Init ... !!!
       107.149634 s: MEM: Initialized DMA HEAP (fd=5) !!!
       107.149851 s: MEM: Init ... Done !!!
       107.149887 s: IPC: Init ... !!!
       107.205711 s: IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
       107.213742 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
       107.213934 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_ERROR
       107.213957 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_WARNING
       107.213981 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_INFO
       107.215012 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-0 
       107.215449 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-1 
       107.215991 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-2 
       107.216467 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-3 
       107.216517 s:  VX_ZONE_INFO: [tivxInitLocal:202] Initialization Done !!!
       107.216609 s:  VX_ZONE_INFO: Globally Disabled VX_ZONE_INFO
    Calculating output tensor dimensions and offsets...
    model datatype : float32
    caps: video/x-raw, width=1920, height=1080, format=RGB, framerate=0/1
    Parsing GST pipeline: 
    input: v4l2src device=/dev/video-usb-cam0  ! image/jpeg,width=640,height=480 ! jpegdec ! tiovxdlcolorconvert  !  video/x-raw, format=NV12 ! queue leaky=2 max-size-buffers=2  ! tiovxmultiscaler name=split_resize     split_resize.   ! video/x-raw, width=246, height=246, format=NV12   ! tiovxdlpreproc out-pool-size=4 data-type=float32   channel-order=nchw tensor-format=rgb  mean-0=0.000000 mean-1=0.000000 mean-2=0.000000 scale-0=0.003922 scale-1=0.003922 scale-2=0.003922  ! application/x-tensor-tiovx  ! appsink name=tensor_in max-buffers=2 drop=True    split_resize. ! queue leaky=2 max-size-buffers=2  ! video/x-raw, width=1536, height=864, format=NV12 ! tiovxdlcolorconvert out-pool-size=4 ! video/x-raw, format=RGB ! appsink name=image_in max-buffers=2 drop=True
    
    output:  appsrc format=GST_FORMAT_TIME is-live=true  name=out ! video/x-raw,  format=RGB, width=1920, height=1080  ! queue ! tiovxdlcolorconvert out-pool-size=4  ! video/x-raw, format=NV12  !  tiperfoverlay main-title=""  ! kmssink sync=false driver-name=tidss  plane-id=31 force-modesetting=True
    
    Starting with in_gst: 
    v4l2src device=/dev/video-usb-cam0  ! image/jpeg,width=640,height=480 ! jpegdec ! tiovxdlcolorconvert  !  video/x-raw, format=NV12 ! queue leaky=2 max-size-buffers=2  ! tiovxmultiscaler name=split_resize     split_resize.   ! video/x-raw, width=246, height=246, format=NV12   ! tiovxdlpreproc out-pool-size=4 data-type=float32   channel-order=nchw tensor-format=rgb  mean-0=0.000000 mean-1=0.000000 mean-2=0.000000 scale-0=0.003922 scale-1=0.003922 scale-2=0.003922  ! application/x-tensor-tiovx  ! appsink name=tensor_in max-buffers=2 drop=True    split_resize. ! queue leaky=2 max-size-buffers=2  ! video/x-raw, width=1536, height=864, format=NV12 ! tiovxdlcolorconvert out-pool-size=4 ! video/x-raw, format=RGB ! appsink name=image_in max-buffers=2 drop=True
    
    
    out gst:  appsrc format=GST_FORMAT_TIME is-live=true  name=out ! video/x-raw,  format=RGB, width=1920, height=1080  ! queue ! tiovxdlcolorconvert out-pool-size=4  ! video/x-raw, format=NV12  !  tiperfoverlay main-title=""  ! kmssink sync=false driver-name=tidss  plane-id=31 force-modesetting=True
    Starting GST pipeline
    pull buffers
    pull buffers
    pull buffers
    pull buffers
    pull buffers
    pull buffers
    pull buffers
    pull buffers
    ...

    摄像头 LED 指示灯未亮起。 对 GStreamer 命令进行一些调试后、我发现流水线无法启动、在执行以下操作后会立即崩溃:

    ! tiovxmultiscaler name=split_resize     split_resize.

    如果您对接下来要查看的内容有任何建议、我将不胜感激。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Adam:

    是的、我看到了问题。 您的摄像头是 720p、但有些缩小尺寸使用更大的分辨率

    split_resize. ! queue leaky=2 max-size-buffers=2  ! video/x-raw, width=1536, height=864, format=NV12

    tiovxmultiscaler 插件(和相应的“MSC"硬件“硬件加速器硬件加速器块)将仅进行缩放图像。 此硬件不支持升级。  

    需要编辑流水线生成的这一部分以处理这种较小的输入分辨率。 输出可视化可能有一个类似的方面。 我看到来自 appsrc 插件的数据预计为 1080p

    appsrc format=GST_FORMAT_TIME is-live=true  name=out ! video/x-raw,  format=RGB, width=1920, height=1080

    该演示软件应用不像 edgeai-gst-apps 那样处理很多输入/输出大小的排列、但在流水线生成逻辑中也不是很复杂

    BR、
    Reese

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    感谢的答复,我修复了管道的设置,一切似乎都是工作的,但没有视频在显示器上...

    root@j722s-evm:/opt/app/edgeai-demo-monodepth-estimation# ./run_demo.sh 
    libtidl_onnxrt_EP loaded 0x25954800 
    Final number of subgraphs created are : 1, - Offloaded Nodes - 84, Total Nodes - 84 
    APP: Init ... !!!
     25671.558889 s: MEM: Init ... !!!
     25671.558968 s: MEM: Initialized DMA HEAP (fd=5) !!!
     25671.559181 s: MEM: Init ... Done !!!
     25671.559215 s: IPC: Init ... !!!
     25671.618936 s: IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
     25671.630651 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
     25671.630877 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_ERROR
     25671.630894 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_WARNING
     25671.630903 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_INFO
     25671.631824 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-0 
     25671.632152 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-1 
     25671.632387 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-2 
     25671.632627 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-3 
     25671.632657 s:  VX_ZONE_INFO: [tivxInitLocal:202] Initialization Done !!!
     25671.632720 s:  VX_ZONE_INFO: Globally Disabled VX_ZONE_INFO
    Calculating output tensor dimensions and offsets...
    model datatype : float32
    caps: video/x-raw, width=1280, height=720, format=RGB, framerate=0/1
    Parsing GST pipeline: 
    input: v4l2src device=/dev/video-usb-cam0  ! image/jpeg,width=1024,height=768 ! jpegdec ! tiovxdlcolorconvert  !  video/x-raw, format=NV12 ! queue leaky=2 max-size-buffers=2  ! tiovxmultiscaler name=split_resize     split_resize.   ! video/x-raw, width=328, height=246, format=NV12  ! tiovxmultiscaler target=1 ! queue leaky=2 max-size-buffers=2 ! video/x-raw, width=246, height=246  ! tiovxdlpreproc out-pool-size=4 data-type=float32   channel-order=nchw tensor-format=rgb  mean-0=0.000000 mean-1=0.000000 mean-2=0.000000 scale-0=0.003922 scale-1=0.003922 scale-2=0.003922  ! application/x-tensor-tiovx  ! appsink name=tensor_in max-buffers=2 drop=True    split_resize. ! queue leaky=2 max-size-buffers=2  ! video/x-raw, width=1024, height=576, format=NV12 ! tiovxdlcolorconvert out-pool-size=4 ! video/x-raw, format=RGB ! appsink name=image_in max-buffers=2 drop=True
    
    output:  appsrc format=GST_FORMAT_TIME is-live=true  name=out ! video/x-raw,  format=RGB, width=1280, height=720  ! queue ! tiovxdlcolorconvert out-pool-size=4  ! video/x-raw, format=NV12  !  tiperfoverlay main-title=""  ! kmssink sync=false driver-name=tidss  plane-id=31 force-modesetting=True
    
    Starting with in_gst: 
    v4l2src device=/dev/video-usb-cam0  ! image/jpeg,width=1024,height=768 ! jpegdec ! tiovxdlcolorconvert  !  video/x-raw, format=NV12 ! queue leaky=2 max-size-buffers=2  ! tiovxmultiscaler name=split_resize     split_resize.   ! video/x-raw, width=328, height=246, format=NV12  ! tiovxmultiscaler target=1 ! queue leaky=2 max-size-buffers=2 ! video/x-raw, width=246, height=246  ! tiovxdlpreproc out-pool-size=4 data-type=float32   channel-order=nchw tensor-format=rgb  mean-0=0.000000 mean-1=0.000000 mean-2=0.000000 scale-0=0.003922 scale-1=0.003922 scale-2=0.003922  ! application/x-tensor-tiovx  ! appsink name=tensor_in max-buffers=2 drop=True    split_resize. ! queue leaky=2 max-size-buffers=2  ! video/x-raw, width=1024, height=576, format=NV12 ! tiovxdlcolorconvert out-pool-size=4 ! video/x-raw, format=RGB ! appsink name=image_in max-buffers=2 drop=True
    
    
    out gst:  appsrc format=GST_FORMAT_TIME is-live=true  name=out ! video/x-raw,  format=RGB, width=1280, height=720  ! queue ! tiovxdlcolorconvert out-pool-size=4  ! video/x-raw, format=NV12  !  tiperfoverlay main-title=""  ! kmssink sync=false driver-name=tidss  plane-id=31 force-modesetting=True
    Starting GST pipeline
    pull buffers
    got GST buffers in app code
    0.06637763977050781
    pull buffers
    got GST buffers in app code
    0.03599214553833008
    pull buffers
    got GST buffers in app code
    0.03386831283569336
    pull buffers
    got GST buffers in app code
    0.03460121154785156
    pull buffers
    got GST buffers in app code
    0.04039931297302246
    pull buffers
    got GST buffers in app code
    0.04718732833862305
    pull buffers
    got GST buffers in app code
    0.05154824256896973
    pull buffers
    got GST buffers in app code
    0.048491477966308594
    pull buffers
    got GST buffers in app code
    0.05122661590576172
    pull buffers
    got GST buffers in app code
    0.04781746864318848
    pull buffers
    got GST buffers in app code
    0.051619529724121094
    pull buffers
    got GST buffers in app code
    0.04768490791320801
    pull buffers
    got GST buffers in app code
    0.05287361145019531
    pull buffers
    got GST buffers in app code
    0.04698657989501953
    pull buffers
    got GST buffers in app code
    0.05157828330993652
    pull buffers
    got GST buffers in app code
    0.04773426055908203
    pull buffers
    got GST buffers in app code
    0.05212545394897461
    pull buffers
    got GST buffers in app code
    0.047638893127441406
    pull buffers
    got GST buffers in app code
    0.05172157287597656
    pull buffers
    got GST buffers in app code
    0.04822945594787598
    pull buffers
    got GST buffers in app code
    0.05141901969909668
    pull buffers
    got GST buffers in app code
    0.047869205474853516
    pull buffers
    got GST buffers in app code
    0.05159640312194824
    pull buffers
    got GST buffers in app code
    0.048233985900878906
    pull buffers
    got GST buffers in app code
    0.051508188247680664
    pull buffers
    got GST buffers in app code
    0.04786062240600586
    pull buffers
    ^CKB shortcut caught
    
    Ran 26 frames
    **** Runtime Stats ****
    ---- Pull input time (ms): avg 19 +- 5 (min to max: 3 to 26)
    ---- infer time (ms): avg 5
    ---- Output (draw, post-proc) time (ms): avg 20 +- 1
    ---- FPS: 20.73
    -----------------------
    
    True
    paused pipe; waiting gst thread to join
    exiting...
    

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    好的、我固定了显示屏、似乎工作正常、但摄像头对物体没有反应。 一切都是蓝色的。
    这是模型编译问题吗?
    除了在应用程序中运行模型之外、是否有办法检查模型是否正确?

      

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好:

    您可能需要将输出张量转储到文件中或添加打印语句以查看数据的分布。 如果它都是相同的输出值、那么这当然是错误。 您使用什么方法来编译模型? 我建议返回该脚本并查看静态图像上的输出数据分布。  

    通常、这些具有视差输出的模型类型需要标准化输出、以便有更好的数据范围。 如果您在使用此处的演示代码(看起来类似)、则在[3]中处理该代码。 也许值得打印出数据的分布

    另一方面、一些模型对 8 位量化特别敏感。 深度/视差图等连续值输出尤其受到这种影响、但也适用于边界框/关键点像素位置等内容。 为了解决这些情况、我们通常混合使用 8 位和 16 位。 通常、仅最后几层需要 16 位层。 对于 Midas 模型,看起来有两个层,我们为[1][2]设置了该选项

    [1] https://github.com/TexasInstruments/edgeai-tensorlab/blob/3de61dfa503c408346c3bcd029f49a25e42a8a73/edgeai-benchmark/configs/depth_estimation.py#L71 --请参见 output_feature_16bit_names_list、该列表包含以逗号分隔的图层名称列表

    [2] https://github.com/TexasInstruments/edgeai-tidl-tools/blob/master/examples/osrt_python/README.md#advanced-options-for-accuracy-enhancement --混合精度设置的参考

    [3] https://github.com/TexasInstruments-Sandbox/edgeai-demo-monodepth-estimation/blob/b5dd792e45d4ead4a0c2f4b089477906519ad085/display.py#L165 --深度图的后处理

    BR、
    Reese

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。



    您好、事实证明该模型的 OSRT 配置存在错误。 给出此结果的配置如下:

        "de-7310_midas-small_onnx": create_model_config(
            task_type="depth_estimation",
            source=dict(
                model_url="">software-dl.ti.com/.../midas-small.onnx",
                infer_shape=True,
            ),
            preprocess=dict(
                resize=[256, 256], 
                crop=[256, 256], 
                data_layout="NCHW",
                pad_color=0,
                resize_with_pad=False,
                reverse_channels=False, 
                add_flip_image=False,
            ),
            session=dict(
                session_name="onnxrt",
                model_path=os.path.join(models_base_path, "midas-small.onnx"),
                target_device="AM67A", 
                input_mean=[123.675, 116.28, 103.53],
                input_scale=[0.017125, 0.017507, 0.017429], 
                input_optimization=False, 
            ),
            postprocess=dict(
                with_argmax=False, 
            ),
            extra_info=dict(
                num_images=numImages, 
                num_classes=1,
            ),
            runtime_options = {
                'advanced_options:output_feature_16bit_names_list' : [511, 983],
            },
        )

    您能回顾一下吗? 也许我错过了一些东西...
    我还注意到,有时有混沌的变化在黑暗的物体上的距离,有没有办法提高估计的稳定性?