A/LIBC:致命信号11(Sigsegv),代码1(SEGV_MAPERR),TID 26201中的故障ADDR 0x0(MediaPipe_GL_RU),PID 26095(apps.facefect)

发布于 2025-01-27 03:15:07 字数 3359 浏览 2 评论 0原文

这是两个相关方法:

absl::Status Open(CalculatorContext* cc) override {
        ...
        
        return gpu_helper_.RunInGlContext([&]() -> absl::Status {

           const auto& options = cc->Options<FaceGeometryEffectRendererCalculatorOptions>();
            
           // If i replace 
           //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile(options._path()),_ << "Failed ");               
           // using 
           //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile("mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob"),_ << "Failed");
           //
           // it will report error:
           // "A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 22251 (mediapipe_gl_ru), pid 21862 (apps.faceeffect)" 
           // 
           // 'ASSIGN_OR_RETURN()' defined here https://github.com/google/mediapipe/blob/ecb5b5f44ab23ea620ef97a479407c699e424aa7/mediapipe/framework/port/status_macros.h 
           
           ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile(options._path()), _ << "Failed ");
           
           // This line print "mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob", this is the main param of above method.
           LOG(INFO) << options.effect_texture_path();  

           ... 
           return absl::OkStatus();
    });
  }




static absl::StatusOr<ImageFrame> ReadTextureFromFile(const std::string& texture_path) {
    ... 
    cv::Mat output_mat;
    switch (decoded_mat.channels()) {
      case 3:
        image_format = ImageFormat::SRGB;
        cv::cvtColor(input_mat, output_mat, cv::COLOR_BGR2RGB);
        break;

      case 4:
        image_format = ImageFormat::SRGBA;
        cv::cvtColor(input_mat, output_mat, cv::COLOR_BGRA2RGBA);
        break;
    }

    ImageFrame output_image_frame(image_format, output_mat.size().width,
                                  output_mat.size().height,
                                  ImageFrame::kGlDefaultAlignmentBoundary);
    output_mat.copyTo(formats::MatView(&output_image_frame));
    
    // This line works fine ,it print 4096. 
    // Even if after replacing
    //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile(options._path()),_ << "Failed ");               
    // using 
    //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile("mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob"),_ << "Failed");
   // this is still can print 4096.

    LOG(INFO) << "output_image_frame.Width() " << output_image_frame.Width() ;  
    return output_image_frame;
  }

我只替换options._path()使用“ MediaPipe/graphs/face_effect/data:ic_cube_maps_left.pngblob”当Invoke ReadTextureFromFile(),然后我得到了此错误a/libc:致命信号11(sigsegv),代码1(segv_maperr),tid 22251中的故障addr 0x0(MediaPipe_GL_RU),PID 21862(Apps.faceeff)有点有线。

方法options._path(),它返回path_.get()path _的类型是 is :: protobuf_namespace_id :::::内部:: Arenastringptr

我在代码注释中添加了大多数说明。似乎更直接。

参考项目: https://github.com/google.com/google/mediapipe

This is the two related method:

absl::Status Open(CalculatorContext* cc) override {
        ...
        
        return gpu_helper_.RunInGlContext([&]() -> absl::Status {

           const auto& options = cc->Options<FaceGeometryEffectRendererCalculatorOptions>();
            
           // If i replace 
           //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile(options._path()),_ << "Failed ");               
           // using 
           //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile("mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob"),_ << "Failed");
           //
           // it will report error:
           // "A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 22251 (mediapipe_gl_ru), pid 21862 (apps.faceeffect)" 
           // 
           // 'ASSIGN_OR_RETURN()' defined here https://github.com/google/mediapipe/blob/ecb5b5f44ab23ea620ef97a479407c699e424aa7/mediapipe/framework/port/status_macros.h 
           
           ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile(options._path()), _ << "Failed ");
           
           // This line print "mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob", this is the main param of above method.
           LOG(INFO) << options.effect_texture_path();  

           ... 
           return absl::OkStatus();
    });
  }




static absl::StatusOr<ImageFrame> ReadTextureFromFile(const std::string& texture_path) {
    ... 
    cv::Mat output_mat;
    switch (decoded_mat.channels()) {
      case 3:
        image_format = ImageFormat::SRGB;
        cv::cvtColor(input_mat, output_mat, cv::COLOR_BGR2RGB);
        break;

      case 4:
        image_format = ImageFormat::SRGBA;
        cv::cvtColor(input_mat, output_mat, cv::COLOR_BGRA2RGBA);
        break;
    }

    ImageFrame output_image_frame(image_format, output_mat.size().width,
                                  output_mat.size().height,
                                  ImageFrame::kGlDefaultAlignmentBoundary);
    output_mat.copyTo(formats::MatView(&output_image_frame));
    
    // This line works fine ,it print 4096. 
    // Even if after replacing
    //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile(options._path()),_ << "Failed ");               
    // using 
    //     ASSIGN_OR_RETURN(ImageFrame effect_texture, ReadTextureFromFile("mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob"),_ << "Failed");
   // this is still can print 4096.

    LOG(INFO) << "output_image_frame.Width() " << output_image_frame.Width() ;  
    return output_image_frame;
  }

I just replace options._path() using "mediapipe/graphs/face_effect/data:ic_cube_maps_left.pngblob" when invoke ReadTextureFromFile() , then i got this error A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 22251 (mediapipe_gl_ru), pid 21862 (apps.faceeffect). it's a little wired.

Method options._path(), it return path_.Get() , and the type of path_ is ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr .

I add most explanation in the code comments. it seems more directly.

Reference project : https://github.com/google/mediapipe

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文