一个用于使用名为深度学习的技术实现漫画插图中分割的 iOS 库。
DeepPanel 允许您从漫画页面上提取所有插图的定位点,这是使用在此处训练的机器学习模型完成的。此 iOS 库完全不使用 OpenCV,这意味着您生成的最终应用程序将尽可能小。我们对模型进行了优化和性能改进,并实现了所需的计算机视觉算法,不使用任何第三方库,以优化最终库的大小和性能。由 TensorFlow lite 驱动,我们的已训练的分割模型和一些本地代码,DeepPanel 能够在不到一秒的时间内找到所有插图的定位点。
请注意,这种人工智能解决方案旨在模拟人类的阅读行为,并会像阅读者一样对相关插图进行分组。
原始 | 分析过的 |
---|---|
![]() |
![]() |
![]() |
![]() |
如果您正在寻找此项目的安卓版本,可以在这里找到它:这里。
我们示例项目中使用的所有页面均由 Peper & Carrot 创作而成,这是一本免费漫画,您现在就应该阅读。
用法
依赖性
在您的 Podfile
中包含库
pod 'DeepPanel'
要开始使用库,您只需要调用 DeepPanel.initialize
。您可以从任何 ViewController
或您的 AppDelegate
类中初始化此库
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
DeepPanel.initialize()
return true
}
}
一旦初始化了库,获取任何漫画页面,将其转换为 UIImage
实例,并使用 extractPanelsInfo
方法提取面板信息,如下所示
let deepPanel = DeepPanel()
let result = deepPanel.extract(bitmapSamplePage)
result.panels.panelsInfo.forEach { panel in
print("\(panel.left) - \(panel.top) - \(panel.right) - \(panel.bottom)")
}
PredictionResult
包含一个包含每张页面上每个面板位置的列表和包含以下标签的整数 2d 矩阵
- 0 - 与内容页关联的标签。
- N - 与页面上的相同面板相关的内容。
不要从主应用程序线程中调用 DeepPanel 的 extractPanelsInfo
。即使我们可以在不到 500ms 的时间内使用常规设备分析页面,您也绝对不应阻止您的应用程序 UI。我们建议您使用任何队列将分析计算从 UI 线程中提取出来。
请注意,对于此库的第一个版本,我们假设每个面板都是一个矩形,即使内容面板内部有不同的形状。我们将在未来改进这一点,但对于我们的第一次发行,我们决定采用这种方法,因为我们始终会在矩形屏幕上表示面板信息。
您想贡献吗?
请随意贡献,我们很高兴在您的帮助下改进此项目。请注意,您的 PR 必须在由 GitHub actions 验证后才可由任何核心贡献者审查。
致谢
特别感谢 Asun,他从未怀疑我们能否发布这个项目。
开发者
- Pedro Vicente Gómez Sánchez - [email protected]
许可协议
Copyright 2020 Pedro Vicente Gómez Sánchez
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://apache.ac.cn/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.