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 boolean
deleteInternal(String name)
Delete all references to a face.float[][]
get(String name)
Load 2D face model from storage.protected String
getInternal(String name)
Load 2D face model from storage.Set<String>
getNames()
Get all known facesprotected Set<String>
getNamesInternal()
Get all known facesboolean
register(String rawname, float[][] alldata, boolean replace)
Register/store new face.protected boolean
registerInternal(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:FaceStorageBackend
Get all known faces- Specified by:
getNamesInternal
in classFaceStorageBackend
- Returns:
Set
of all known faces (names only)
-
registerInternal
protected boolean registerInternal(String name, String data, boolean duplicate)
Description copied from class:FaceStorageBackend
Register/store new face.- Specified by:
registerInternal
in 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:FaceStorageBackend
Load 2D face model from storage.- Specified by:
getInternal
in classFaceStorageBackend
- Parameters:
name
- The name of the face to load.- Returns:
- The face model.
-
deleteInternal
protected boolean deleteInternal(String name)
Description copied from class:FaceStorageBackend
Delete all references to a face.- Specified by:
deleteInternal
in classFaceStorageBackend
- Parameters:
name
- The face to delete.- Returns:
- If deletion was successful.
-
getNames
public Set<String> getNames()
Description copied from class:FaceStorageBackend
Get all known faces- Overrides:
getNames
in classFaceStorageBackend
- Returns:
Set
of all known faces (names only)
-
register
public boolean register(String rawname, float[][] alldata, boolean replace)
Description copied from class:FaceStorageBackend
Register/store new face.- Overrides:
register
in 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:FaceStorageBackend
Load 2D face model from storage.- Overrides:
get
in classFaceStorageBackend
- Parameters:
name
- The name of the face to load.- Returns:
- The face model.
-
-