run ml definitely after 5 batches (200 files each)

This commit is contained in:
Abhinav 2022-08-05 11:33:26 +05:30
parent d515186450
commit 85638acb2b
2 changed files with 8 additions and 3 deletions

View file

@ -97,3 +97,5 @@ export const SCENE_DETECTION_IMAGE_SIZE = 224;
// SSD with Mobilenet v2 initialized from Imagenet classification checkpoint. Trained on COCO 2017 dataset (images scaled to 320x320 resolution). // SSD with Mobilenet v2 initialized from Imagenet classification checkpoint. Trained on COCO 2017 dataset (images scaled to 320x320 resolution).
// https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2 // https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2
export const OBJECT_DETECTION_IMAGE_SIZE = 320; export const OBJECT_DETECTION_IMAGE_SIZE = 320;
export const BATCHES_BEFORE_SYNCING_INDEX = 5;

View file

@ -25,7 +25,10 @@ import { MLFactory } from './machineLearningFactory';
import mlIDbStorage from 'utils/storage/mlIDbStorage'; import mlIDbStorage from 'utils/storage/mlIDbStorage';
import { getMLSyncConfig } from 'utils/machineLearning/config'; import { getMLSyncConfig } from 'utils/machineLearning/config';
import { CustomError, parseServerError } from 'utils/error'; import { CustomError, parseServerError } from 'utils/error';
import { MAX_ML_SYNC_ERROR_COUNT } from 'constants/machineLearning/config'; import {
BATCHES_BEFORE_SYNCING_INDEX,
MAX_ML_SYNC_ERROR_COUNT,
} from 'constants/machineLearning/config';
import FaceService from './faceService'; import FaceService from './faceService';
import PeopleService from './peopleService'; import PeopleService from './peopleService';
import ObjectService from './objectService'; import ObjectService from './objectService';
@ -82,8 +85,8 @@ class MachineLearningService {
// may be need to just take synced files on latest ml version for indexing // may be need to just take synced files on latest ml version for indexing
if ( if (
syncContext.outOfSyncFiles.length <= 0 || syncContext.outOfSyncFiles.length <= 0 ||
(syncContext.nSyncedFiles === syncContext.config.batchSize && syncContext.nSyncedFiles ===
Math.random() < 0.2) syncContext.config.batchSize * BATCHES_BEFORE_SYNCING_INDEX
) { ) {
await this.syncIndex(syncContext); await this.syncIndex(syncContext);
} }