|
|
@@ -207,8 +207,8 @@ class PhotoScanHandler {
|
|
|
|
|
|
peoplePhotos.clear();
|
|
|
if (ImagePickerUtil.peoplePhotos.isNotEmpty) {
|
|
|
- for (var personPhotos in ImagePickerUtil.peoplePhotos) {
|
|
|
- peoplePhotos.add(personPhotos);
|
|
|
+ for (var personPhoto in ImagePickerUtil.peoplePhotos) {
|
|
|
+ peoplePhotos.add(personPhoto);
|
|
|
if (peoplePhotos.length == 2) {
|
|
|
break;
|
|
|
}
|
|
|
@@ -247,23 +247,13 @@ class PhotoScanHandler {
|
|
|
progress.value = event.progress;
|
|
|
final result = event.result;
|
|
|
if (result != null) {
|
|
|
- similarResult.addAll(result.similarGroups ?? []);
|
|
|
- for (var group in similarResult) {
|
|
|
- await ImagePickerUtil.newUpdatePhotos("similar", group.images);
|
|
|
- }
|
|
|
- peopleResult.addAll (result.peopleImages ?? []);
|
|
|
- await ImagePickerUtil.newUpdatePhotos("people", peopleResult);
|
|
|
- screenshotResult.addAll(result.screenshotImages ?? []);
|
|
|
- await ImagePickerUtil.newUpdatePhotos(
|
|
|
- "screenshot", screenshotResult);
|
|
|
- blurryResult.addAll(result.blurryImages ?? []);
|
|
|
- await ImagePickerUtil.newUpdatePhotos("blurry", blurryResult);
|
|
|
+ await loadData(result);
|
|
|
}
|
|
|
if (event.progress?.isCompleted == true) {
|
|
|
isClassifying.value = false;
|
|
|
_subscription?.cancel();
|
|
|
_subscription = null;
|
|
|
- completeClassification();
|
|
|
+ Future.delayed(Duration(seconds: 3),(){ completeClassification();});
|
|
|
}
|
|
|
},
|
|
|
onError: (error) {
|
|
|
@@ -275,6 +265,8 @@ class PhotoScanHandler {
|
|
|
errorMessage.value = '分类过程意外结束';
|
|
|
isClassifying.value = false;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
);
|
|
|
} catch (e) {
|
|
|
@@ -303,8 +295,6 @@ class PhotoScanHandler {
|
|
|
void completeClassification() {
|
|
|
if (ImagePickerUtil.similarPhotos.isNotEmpty) {
|
|
|
for (var group in ImagePickerUtil.similarPhotos) {
|
|
|
- print(
|
|
|
- " ImagePickerUtil.similarPhotos ${ImagePickerUtil.similarPhotos.length}");
|
|
|
for (var asset in group) {
|
|
|
similarPhotos.add(asset);
|
|
|
if (similarPhotos.length == 4) {
|
|
|
@@ -313,14 +303,7 @@ class PhotoScanHandler {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (ImagePickerUtil.peoplePhotos.isNotEmpty) {
|
|
|
- for (var personPhotos in ImagePickerUtil.peoplePhotos) {
|
|
|
- peoplePhotos.add(personPhotos);
|
|
|
- if (peoplePhotos.length == 2) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if (ImagePickerUtil.blurryPhotos.isNotEmpty) {
|
|
|
var asset = ImagePickerUtil.blurryPhotos.first;
|
|
|
blurryPhoto.value = asset;
|
|
|
@@ -330,7 +313,46 @@ class PhotoScanHandler {
|
|
|
var asset = ImagePickerUtil.screenshotPhotos.first;
|
|
|
screenshotPhoto.value = asset;
|
|
|
}
|
|
|
+ print("qqq personPhotos ${ImagePickerUtil.peoplePhotos.length}");
|
|
|
+ if (ImagePickerUtil.peoplePhotos.isNotEmpty) {
|
|
|
+ for (AssetEntity personPhotos in ImagePickerUtil.peoplePhotos) {
|
|
|
+ print("qqq personPhotos ${personPhotos.id}");
|
|
|
+ peoplePhotos.add(personPhotos);
|
|
|
+ if (peoplePhotos.length == 2) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ isSimilarScanned.value = true;
|
|
|
+ isPeopleScanned.value = true;
|
|
|
+ isBlurryScanned.value = true;
|
|
|
+ isScreenShotScanned.value = true;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ loadData(ClassificationResult result) async {
|
|
|
+
|
|
|
+ if(result.similarGroups!=null){
|
|
|
+ similarResult.assignAll(result.similarGroups??[]);
|
|
|
+ await ImagePickerUtil.newUpdatePhotoGroups("similar", similarResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(result.peopleImages!=null){
|
|
|
+ peopleResult.addAll(result.peopleImages ?? []);
|
|
|
+ await ImagePickerUtil.newUpdatePhotoGroup("people", peopleResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(result.screenshotImages!=null) {
|
|
|
+ screenshotResult.addAll(result.screenshotImages ?? []);
|
|
|
+ await ImagePickerUtil.newUpdatePhotoGroup(
|
|
|
+ "screenshots", screenshotResult);
|
|
|
+ }
|
|
|
+ if(result.blurryImages!=null){
|
|
|
+ blurryResult.addAll(result.blurryImages ?? []);
|
|
|
+ await ImagePickerUtil.newUpdatePhotoGroup("blurry", blurryResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|