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 · 4 comments
Open

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

zcs110 opened this issue Dec 6, 2023 · 4 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@example.com' }
  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给我吗zwsyiyibubu@gmail.com

@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给我吗zwsyiyibubu@gmail.com

https://github.com/kennenfromchina/LPRDemo

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

2 participants