mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 00:33:03 +08:00
[Bug Fix] fix FastDeploy.cmake.in errors for Android (#616)
* [Backend] fix lite backend save model error * [Backend] fixed typos * [FlyCV] optimize the integration of FlyCV * [cmake] close some tests options * [cmake] close some test option * [FlyCV] remove un-need warnings * [FlyCV] remove un-need GetMat method * [FlyCV] optimize FlyCV codes * [cmake] remove un-need cmake function in examples/CMakelists * [cmake] support gflags for Android * [Android] Run button shutter in sub Ui Thread * [Android] Update CameraSurfaceView * [Android] Update Android SDK usage docs * [Android] Add facedet Android app example * [cmake] fix FastDeploy.cmake.in errors for Android * [Doc] update SetProcLibCpuNumThreads API doc
This commit is contained in:
@@ -15,14 +15,14 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".facedet.FaceDetMainActivity">
|
||||
<activity android:name=".detection.DetectionMainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".facedet.FaceDetSettingsActivity"
|
||||
android:name=".detection.DetectionSettingsActivity"
|
||||
android:label="Settings">
|
||||
</activity>
|
||||
</application>
|
||||
|
@@ -77,8 +77,8 @@ public class ClassificationMainActivity extends Activity implements View.OnClick
|
||||
private static final int INTENT_CODE_PICK_IMAGE = 100;
|
||||
|
||||
String savedImagePath = "result.jpg";
|
||||
int lastFrameIndex = 0;
|
||||
long lastFrameTime;
|
||||
long timeElapsed = 0;
|
||||
long frameCounter = 0;
|
||||
|
||||
// Call 'init' and 'release' manually later
|
||||
PaddleClasModel predictor = new PaddleClasModel();
|
||||
@@ -203,25 +203,31 @@ public class ClassificationMainActivity extends Activity implements View.OnClick
|
||||
originShutterBitmap = ARGB8888ImageBitmap;
|
||||
}
|
||||
boolean modified = false;
|
||||
|
||||
long tc = System.currentTimeMillis();
|
||||
ClassifyResult result = predictor.predict(
|
||||
ARGB8888ImageBitmap, true, ClassificationSettingsActivity.scoreThreshold);
|
||||
|
||||
timeElapsed += (System.currentTimeMillis() - tc);
|
||||
frameCounter++;
|
||||
|
||||
modified = result.initialized();
|
||||
if (!savedImagePath.isEmpty()) {
|
||||
synchronized (this) {
|
||||
ClassificationMainActivity.this.savedImagePath = "result.jpg";
|
||||
}
|
||||
}
|
||||
lastFrameIndex++;
|
||||
if (lastFrameIndex >= 30) {
|
||||
final int fps = (int) (lastFrameIndex * 1e9 / (System.nanoTime() - lastFrameTime));
|
||||
|
||||
if (frameCounter >= 30) {
|
||||
final int fps = (int) (1000 / (timeElapsed / 30));
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void run() {
|
||||
tvStatus.setText(Integer.toString(fps) + "fps");
|
||||
}
|
||||
});
|
||||
lastFrameIndex = 0;
|
||||
lastFrameTime = System.nanoTime();
|
||||
frameCounter = 0;
|
||||
timeElapsed = 0;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
@@ -84,8 +84,8 @@ public class DetectionMainActivity extends Activity implements View.OnClickListe
|
||||
private static final int TIME_SLEEP_INTERVAL = 50; // ms
|
||||
|
||||
String savedImagePath = "result.jpg";
|
||||
int lastFrameIndex = 0;
|
||||
long lastFrameTime;
|
||||
long timeElapsed = 0;
|
||||
long frameCounter = 0;
|
||||
|
||||
// Call 'init' and 'release' manually later
|
||||
PicoDet predictor = new PicoDet();
|
||||
@@ -159,7 +159,7 @@ public class DetectionMainActivity extends Activity implements View.OnClickListe
|
||||
public void run() {
|
||||
try {
|
||||
// Sleep some times to ensure picture has been correctly shut.
|
||||
Thread.sleep(TIME_SLEEP_INTERVAL * 2); // 100ms
|
||||
Thread.sleep(TIME_SLEEP_INTERVAL * 10); // 500ms
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -251,25 +251,30 @@ public class DetectionMainActivity extends Activity implements View.OnClickListe
|
||||
}
|
||||
|
||||
boolean modified = false;
|
||||
|
||||
long tc = System.currentTimeMillis();
|
||||
DetectionResult result = predictor.predict(
|
||||
ARGB8888ImageBitmap, true, DetectionSettingsActivity.scoreThreshold);
|
||||
timeElapsed += (System.currentTimeMillis() - tc);
|
||||
frameCounter++;
|
||||
|
||||
modified = result.initialized();
|
||||
if (!savedImagePath.isEmpty()) {
|
||||
synchronized (this) {
|
||||
DetectionMainActivity.this.savedImagePath = "result.jpg";
|
||||
}
|
||||
}
|
||||
lastFrameIndex++;
|
||||
if (lastFrameIndex >= 30) {
|
||||
final int fps = (int) (lastFrameIndex * 1e9 / (System.nanoTime() - lastFrameTime));
|
||||
|
||||
if (frameCounter >= 30) {
|
||||
final int fps = (int) (1000 / (timeElapsed / 30));
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void run() {
|
||||
tvStatus.setText(Integer.toString(fps) + "fps");
|
||||
}
|
||||
});
|
||||
lastFrameIndex = 0;
|
||||
lastFrameTime = System.nanoTime();
|
||||
frameCounter = 0;
|
||||
timeElapsed = 0;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
@@ -36,7 +36,6 @@ import com.baidu.paddle.fastdeploy.app.ui.view.ResultListView;
|
||||
import com.baidu.paddle.fastdeploy.app.ui.Utils;
|
||||
import com.baidu.paddle.fastdeploy.app.ui.view.adapter.BaseResultAdapter;
|
||||
import com.baidu.paddle.fastdeploy.app.ui.view.model.BaseResultModel;
|
||||
import com.baidu.paddle.fastdeploy.vision.DetectionResult;
|
||||
import com.baidu.paddle.fastdeploy.vision.FaceDetectionResult;
|
||||
import com.baidu.paddle.fastdeploy.vision.facedet.SCRFD;
|
||||
|
||||
@@ -84,8 +83,8 @@ public class FaceDetMainActivity extends Activity implements View.OnClickListene
|
||||
private static final int TIME_SLEEP_INTERVAL = 50; // ms
|
||||
|
||||
String savedImagePath = "result.jpg";
|
||||
int lastFrameIndex = 0;
|
||||
long lastFrameTime;
|
||||
long timeElapsed = 0;
|
||||
long frameCounter = 0;
|
||||
|
||||
// Call 'init' and 'release' manually later
|
||||
SCRFD predictor = new SCRFD();
|
||||
@@ -159,7 +158,7 @@ public class FaceDetMainActivity extends Activity implements View.OnClickListene
|
||||
public void run() {
|
||||
try {
|
||||
// Sleep some times to ensure picture has been correctly shut.
|
||||
Thread.sleep(TIME_SLEEP_INTERVAL * 2); // 100ms
|
||||
Thread.sleep(TIME_SLEEP_INTERVAL * 10); // 500ms
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -251,25 +250,31 @@ public class FaceDetMainActivity extends Activity implements View.OnClickListene
|
||||
}
|
||||
|
||||
boolean modified = false;
|
||||
|
||||
long tc = System.currentTimeMillis();
|
||||
FaceDetectionResult result = predictor.predict(
|
||||
ARGB8888ImageBitmap, true, FaceDetSettingsActivity.scoreThreshold, 0.4f);
|
||||
|
||||
timeElapsed += (System.currentTimeMillis() - tc);
|
||||
frameCounter++;
|
||||
|
||||
modified = result.initialized();
|
||||
if (!savedImagePath.isEmpty()) {
|
||||
synchronized (this) {
|
||||
FaceDetMainActivity.this.savedImagePath = "result.jpg";
|
||||
}
|
||||
}
|
||||
lastFrameIndex++;
|
||||
if (lastFrameIndex >= 30) {
|
||||
final int fps = (int) (lastFrameIndex * 1e9 / (System.nanoTime() - lastFrameTime));
|
||||
|
||||
if (frameCounter >= 30) {
|
||||
final int fps = (int) (1000 / (timeElapsed / 30));
|
||||
runOnUiThread(new Runnable() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void run() {
|
||||
tvStatus.setText(Integer.toString(fps) + "fps");
|
||||
}
|
||||
});
|
||||
lastFrameIndex = 0;
|
||||
lastFrameTime = System.nanoTime();
|
||||
frameCounter = 0;
|
||||
timeElapsed = 0;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
|
Reference in New Issue
Block a user