Skip to content
This repository was archived by the owner on Apr 8, 2023. It is now read-only.

Commit e06af97

Browse files
committed
优化模型支持GPU加速
1 parent 4c98491 commit e06af97

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

OpenNSFW/src/main/java/com/zwy/opennsfw/core/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data class Config(
66
/**
77
* 是否开启GPU加速
88
*/
9-
var isOpenGPU: Boolean = false,
9+
var isOpenGPU: Boolean = true,
1010
var numThreads: Int = 1,
1111
var context: Context?
1212
)

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
![MVVM](https://github.com/devzwy/open_nsfw_android/blob/dev/img/4.jpg)
1818

19+
20+
#### 1.3.1版本优化说明:
21+
模型大小改动较大,原量化模型虽小(6M),但对GPU加速支持不友好,新模型大约26M,完美支持GPU加速并优化识别精度,加速效果明显。建议全部升级该版本。__新版本的GPU加速默认开启状态__,SDK默认会检测设备是否支持,不支持时会自动取消加速(老版本会奔溃)
22+
1923
### 使用
2024
- Add it in your root build.gradle at the end of repositories:
2125
```

demo/src/main/java/com/zwy/demo/NSFWApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class NSFWApplication : MultiDexApplication() {
2828
//初始化鉴黄库NSFW
2929
Classifier.Build()
3030
.context(this) //必须调用 否则会有异常抛出
31-
.isOpenGPU(true)//默认不开启GPU加速 部分机型开启会奔溃,自行选择,默认false
31+
.isOpenGPU(true)//默认不开启GPU加速,默认为true
3232
.numThreads(100) //分配的线程数 根据手机配置设置,默认1
3333
.build()
3434
//全局注入对象

0 commit comments

Comments
 (0)