Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Frameworks如何配置模型文件地址 #388

Open
zcs110 opened this issue Dec 6, 2023 · 9 comments
Open

iOS Frameworks如何配置模型文件地址 #388

zcs110 opened this issue Dec 6, 2023 · 9 comments

Comments

@zcs110
Copy link

zcs110 commented Dec 6, 2023

// 配置车牌识别参数
configuration.models_path = model_path; // 模型文件夹路径
这个model_path在iOS Frameworks中如何配置呢。

@kennenfromchina
Copy link

同问,iOS编译好framework之后,如何使用呢?参照linux代码去使用要初始化,model_path怎么配置?

@kennenfromchina
Copy link

我配置好了,把models/r2_mobile里面的文件拷贝到项目目录,models_path设置为项目根目录就行了,但是有一个问题,我编译好的framework直接在项目中使用是可以的,但是打包成一个podsepc给Flutter用就编译失败,提示/chinese_license_plate_recognition/example/ios/Pods/Headers/Public/chinese_license_plate_recognition/chinese_license_plate_recognition-umbrella.h:14:9 'hyper_lpr_sdk.h' file not found
以下是我的podspec文件

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint chinese_license_plate_recognition.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
  s.name             = 'chinese_license_plate_recognition'
  s.version          = '0.0.1'
  s.summary          = 'A new Flutter plugin project.'
  s.description      = <<-DESC
A new Flutter plugin project.
                       DESC
  s.homepage         = 'http://example.com'
  s.license          = { :file => '../LICENSE' }
  s.author           = { 'Your Company' => '[email protected]' }
  s.source           = { :path => '.' }
  s.source_files = 'Classes/**/*'
  s.public_header_files = 'Classes/**/*.h'
  s.dependency 'Flutter'
  s.platform = :ios, '9.0'

  # 添加 CoreML.framework 作为依赖项
  s.frameworks = 'CoreML'

  # 指定 framework 目录
  s.vendored_frameworks = 'Classes/Frameworks/*.framework'
  
  s.exclude_files = "Classes/Frameworks/*.framework/*.plist"

  # 指定 models 目录
  s.resource_bundles = {
    'chinese_license_plate_recognition' => ['Classes/models/*.mnn']
  }

  # Flutter.framework does not contain a i386 slice.
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
end

项目目录为:

- ios
    - chinese_license_plate_recognition.podspec
    - Classes
      - Frameworks
        - hyperlpr3.framework
        - MNN.framework
        - opencv2.framework
      - models
        - b320_backbone_h.mnn
        - b320_header_h.mnn
        - b640x_backbone_h.mnn
        - b640x_head_h.mnn
        - litemodel_cls_96xh.mnn
        - rpv3_mdict_160h.mnn
      - ChineseLicensePlateRecognitionPlugin.h
      - ChineseLicensePlateRecognitionPlugin.m

@zcs110
Copy link
Author

zcs110 commented Jan 15, 2024

我配置好了,把models/r2_mobile里面的文件拷贝到项目目录,models_path设置为项目根目录就行了
我配置好了环境 但是检测的时候报错
det_arch.cpp
cv::resize(bgr, resized_img, cv::Size(w, h));
[InferenceHelperMnn][180] ios use cpu backend.Reshape error: 480 -> 0
你可以发一个demo给我吗[email protected]

@kennenfromchina
Copy link

我配置好了,把models/r2_mobile里面的文件拷贝到项目目录,models_path设置为项目根目录就行了
我配置好了环境 但是检测的时候报错
det_arch.cpp
cv::resize(bgr, resized_img, cv::Size(w, h));
[InferenceHelperMnn][180] ios use cpu backend.Reshape error: 480 -> 0
你可以发一个demo给我吗[email protected]

https://github.com/kennenfromchina/LPRDemo

@kennenfromchina
Copy link

双层车牌识别请问怎么配置?

@qianxiaoer
Copy link

qianxiaoer commented Nov 8, 2024 via email

@wisdom1314
Copy link

我配置好了,把models/r2_mobile里面的文件拷贝到项目目录,models_path设置为项目根目录就行了
我配置好了环境 但是检测的时候报错
det_arch.cpp
cv::resize(bgr, resized_img, cv::Size(w, h));
[InferenceHelperMnn][180] ios use cpu backend.Reshape error: 480 -> 0
你可以发一个demo给我吗[email protected]

https://github.com/kennenfromchina/LPRDemo

你好,你的这个demo我跑通去扫车牌。识别率很低。是还需要配置什么吗

@kennenfromchina
Copy link

kennenfromchina commented Dec 12, 2024 via email

@wisdom1314
Copy link

试试这样配置 // Configure license plate recognition parameters HLPR_ContextConfiguration configuration = {0}; configuration.models_path = (char ) modelPathC; configuration.max_num = 1; configuration.det_level = DETECT_LEVEL_HIGH; configuration.use_half = false; configuration.nms_threshold = 0.85f; configuration.rec_confidence_threshold = 0.95f; configuration.box_conf_threshold = 0.50f; configuration.threads = 1;

2024年12月12日 15:29,wisdomZhang @.
> 写道: 我配置好了,把models/r2_mobile里面的文件拷贝到项目目录,models_path设置为项目根目录就行了 我配置好了环境 但是检测的时候报错 det_arch.cpp cv::resize(bgr, resized_img, cv::Size(w, h)); [InferenceHelperMnn][180] ios use cpu backend.Reshape error: 480 -> 0 @.* @.***> https://github.com/kennenfromchina/LPRDemo 你好,你的这个demo我跑通去扫车牌。识别率很低。是还需要配置什么吗 — Reply to this email directly, view it on GitHub <#388 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRLTLHQ2DKBQHMB2WFD2PL2FE3NHAVCNFSM6AAAAABRMX7W5OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZYGAYTINZRGI. You are receiving this because you commented.

好的,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants