public class DeepMARCaffe2Native extends Object implements DeepMARCaffe2, BatchRecognizer
DeepMAR.PointerManager
Modifier and Type | Field and Description |
---|---|
private int |
lastBatchSize
|
private Logger |
logger
|
private float[][] |
multiOutputBuf
|
private long |
net
|
private float[] |
outputBuf
|
ATTR_LIST,
INPUT_HEIGHT,
INPUT_WIDTH,
MEAN_PIXEL,
POINTERS,
random,
REG_COEFF
Constructor and Description |
---|
DeepMARCaffe2Native(String gpu,
File init_net,
File predict_net,
Logger logger)
Create an instance of DeepMARCaffe2Native.
|
DeepMARCaffe2Native(String gpu,
Logger logger)
Create an instance of DeepMARCaffe2Native.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Free the network.
|
private void |
free(long p)
Free the network.
|
private long |
initialize(int gpu,
String pbPath,
String modelPath)
Initialize the native DeepMAR network.
|
void |
recognize(long net,
float[][] pixelBytes,
float[][] outputBuf)
Recognize attributes from a batch of images using the network.
|
void |
recognize(long net,
float[] pixelBytes,
float[] outputBuf)
Recognize attributes from an image using the network.
|
Attributes |
recognize(Tracklet.BoundingBox bbox)
Recognize attributes from a pedestrian bounding box image.
|
Attributes[]
|
recognize(Tracklet.BoundingBox[] bboxes)
Recognize attributes from a batch of pedestrian bounding box
images.
|
Attributes |
recognize(Tracklet tracklet)
Recognize attributes from a pedestrian tracklet.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInitNetProtobuf,
getPredictNetModel
fillAttributes,
preprocess,
randomlyPickGPU
private long net
private final float[] outputBuf
private float[][] multiOutputBuf
private int lastBatchSize
private Logger logger
public DeepMARCaffe2Native(String gpu, @Nonnull File init_net, @Nonnull File predict_net, @Nonnull Logger logger) throws FileNotFoundException, AccessDeniedException, CharacterCodingException
gpu
- index of GPU to use.
If multiple GPU IDs are provided (separated by comma), randomly select one.
init_net
- DeepMARCaffe2Native init net protobuf file.predict_net
- DeepMARCaffe2Native predict net protobuf file.FileNotFoundException
AccessDeniedException
CharacterCodingException
public DeepMARCaffe2Native(String gpu, @Nonnull Logger logger) throws IOException
gpu
- index of GPU to use.
If multiple GPU IDs are provided (separated by comma), randomly select one.
IOException
private long initialize(int gpu, @Nonnull String pbPath, @Nonnull String modelPath)
gpu
- index of GPU to run on.pbPath
- ASCII path of protocol buffer.modelPath
- ASCII path of Caffe model.private void free(long p)
p
- the pointer to the network.public void recognize(long net, @Nonnull float[] pixelBytes, @Nonnull float[] outputBuf)
net
- the pointer to the network.pixelBytes
- pixel bytes retrieved from the image.outputBuf
- buffer for returning the FC8 result.public void recognize(long net, @Nonnull float[][] pixelBytes, @Nonnull float[][] outputBuf)
net
- the pointer to the network.pixelBytes
- pixel bytes retrieved from each of the images in the
batch.
outputBuf
- buffer for returning the FC8 results for each of the
images in the batch.
protected void finalize() throws Throwable
@Nonnull public Attributes recognize(@Nonnull Tracklet tracklet)
recognize
in
interface Recognizer
tracklet
- a pedestrian tracklet.@Nonnull public Attributes recognize(@Nonnull Tracklet.BoundingBox bbox)
bbox
- the bounding box containing the target pedestrian image.
@Nonnull public Attributes[] recognize(@Nonnull Tracklet.BoundingBox[] bboxes)
recognize
in
interface BatchRecognizer
bboxes
- a batch of bounding boxes containing the images.