Package com.libremobileos.yifan.face
Class VolatileFaceStorageBackend
- java.lang.Object
-
- com.libremobileos.yifan.face.FaceStorageBackend
-
- com.libremobileos.yifan.face.VolatileFaceStorageBackend
-
public class VolatileFaceStorageBackend extends FaceStorageBackend
In-memory FaceStorageBackend, bypassing encoding and storage, relying on cache entirely for performance
-
-
Constructor Summary
Constructors Constructor Description VolatileFaceStorageBackend()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleandeleteInternal(String name)Delete all references to a face.float[][]get(String name)Load 2D face model from storage.protected StringgetInternal(String name)Load 2D face model from storage.Set<String>getNames()Get all known facesprotected Set<String>getNamesInternal()Get all known facesbooleanregister(String rawname, float[][] alldata, boolean replace)Register/store new face.protected booleanregisterInternal(String name, String data, boolean duplicate)Register/store new face.-
Methods inherited from class com.libremobileos.yifan.face.FaceStorageBackend
delete, extendRegistered, register, register
-
-
-
-
Method Detail
-
getNamesInternal
protected Set<String> getNamesInternal()
Description copied from class:FaceStorageBackendGet all known faces- Specified by:
getNamesInternalin classFaceStorageBackend- Returns:
Setof all known faces (names only)
-
registerInternal
protected boolean registerInternal(String name, String data, boolean duplicate)
Description copied from class:FaceStorageBackendRegister/store new face.- Specified by:
registerInternalin classFaceStorageBackend- Parameters:
name- Name of the face, needs to be unique.data- Face detection model data to store.duplicate- Only true if we are adding a duplicate and want to replace the saved one.- Returns:
- If registering was successful.
-
getInternal
protected String getInternal(String name)
Description copied from class:FaceStorageBackendLoad 2D face model from storage.- Specified by:
getInternalin classFaceStorageBackend- Parameters:
name- The name of the face to load.- Returns:
- The face model.
-
deleteInternal
protected boolean deleteInternal(String name)
Description copied from class:FaceStorageBackendDelete all references to a face.- Specified by:
deleteInternalin classFaceStorageBackend- Parameters:
name- The face to delete.- Returns:
- If deletion was successful.
-
getNames
public Set<String> getNames()
Description copied from class:FaceStorageBackendGet all known faces- Overrides:
getNamesin classFaceStorageBackend- Returns:
Setof all known faces (names only)
-
register
public boolean register(String rawname, float[][] alldata, boolean replace)
Description copied from class:FaceStorageBackendRegister/store new face.- Overrides:
registerin classFaceStorageBackend- Parameters:
rawname- Name of the face, needs to be unique.alldata- Face detection model data to store.replace- Allow replacing an already registered face (based on name). If false and it's still attempted, the method returns false and does nothing.- Returns:
- If registering was successful.
- See Also:
FaceStorageBackend.register(String, float[][]),FaceStorageBackend.register(String, float[])
-
get
public float[][] get(String name)
Description copied from class:FaceStorageBackendLoad 2D face model from storage.- Overrides:
getin classFaceStorageBackend- Parameters:
name- The name of the face to load.- Returns:
- The face model.
-
-