cyz6668 / android_onnx_chinese_clip

3 stars 0 forks source link

lacks files #1

Open xiaoniuba opened 1 week ago

xiaoniuba commented 1 week ago

Hello, the project lacks files. Could you provide the files in src?

cyz6668 commented 1 week ago

You can download the pt file and use the chinese_clip deploy script to get the onnx. That's all you lack.

cyz6668 commented 1 week ago

I need to be back home to search for the models.

xiaoniuba commented 1 week ago

I have converted imgfp32-sim.onnx, txtfp32-sim.onnx. I failed to Make Project, error: resource xml/data_extraction_rules (aka demo.android_onnx_sam:xml/data_extraction_rules) not found. error: resource xml/backup_rules (aka demo.android_onnx_sam:xml/backup_rules) not found. error: resource mipmap/ic_launcher (aka demo.android_onnx_sam:mipmap/ic_launcher) not found. error: resource string/app_name (aka demo.android_onnx_sam:string/app_name) not found. error: resource mipmap/ic_launcher_round (aka demo.android_onnx_sam:mipmap/ic_launcher_round) not found. error: resource style/Theme.Android_onnx_sam (aka demo.android_onnx_sam:style/Theme.Android_onnx_sam) not found.

cyz6668 commented 1 week ago

maybe you can rebuild resources and the UI. this is the answer I asked 通义千问 这些错误信息表明你的 Android 项目在编译时找不到指定的资源文件。具体来说,编译器在 xml/, mipmap/, string/style/ 目录下没有找到对应的资源文件。以下是每个错误的具体解释和可能的解决方案:

  1. xml/data_extraction_rulesxml/backup_rules 未找到

    • 这些 XML 文件通常用于定义数据提取规则或备份规则。
    • 解决方法:确保这些 XML 文件存在于 res/xml/ 目录中。如果不需要这些文件,可以检查项目的代码和配置文件(如 AndroidManifest.xml),看看是否有引用到这些文件的地方,并移除这些引用。
  2. mipmap/ic_launchermipmap/ic_launcher_round 未找到

    • 这些是应用图标文件。ic_launcher 是标准的应用图标,而 ic_launcher_round 是用于圆形图标的版本。
    • 解决方法:确保这些图标文件存在于 res/mipmap-*/ 目录中(例如 mipmap-hdpi, mipmap-mdpi, mipmap-xhdpi 等)。如果没有这些文件,你可以创建新的图标或者从其他地方复制现有的图标文件。你也可以使用 Android Studio 的 Image Asset 工具来生成这些图标。
  3. string/app_name 未找到

    • 这是一个字符串资源,通常用于设置应用的名字。
    • 解决方法:确保在 res/values/strings.xml 文件中有定义 app_name 字符串。例如:
      <resources>
       <string name="app_name">Your App Name</string>
      </resources>
  4. style/Theme.Android_onnx_sam 未找到

    • 这是一个样式资源,通常用于定义应用的主题。
    • 解决方法:确保在 res/values/styles.xml 文件中有定义 Theme.Android_onnx_sam 样式。例如:
      <resources>
       <style name="Theme.Android_onnx_sam" parent="Theme.MaterialComponents.DayNight">
           <!-- Customize your theme here. -->
       </style>
      </resources>

      如果你不想自定义主题,可以使用一个内置的主题作为父主题,比如 Theme.MaterialComponents.LightTheme.MaterialComponents.Dark

一般步骤

  1. 检查目录结构:确保所有需要的资源文件都位于正确的目录下。
  2. 清理和重建项目:有时候缓存问题会导致资源找不到,尝试清理项目并重新构建:
    • 在 Android Studio 中选择 Build > Clean Project
    • 然后选择 Build > Rebuild Project
  3. 检查依赖项:如果你的项目依赖于其他库或模块,确保这些依赖项已经正确添加并且它们的资源也已包含在内。
  4. 同步项目:点击 File > Sync Project with Gradle Files 来确保项目与 Gradle 配置同步。

通过以上步骤,你应该能够解决这些资源未找到的问题。如果问题仍然存在,请检查具体的代码引用和资源配置,确保没有任何拼写错误或路径错误。