21 #include "include/Beatmup_NNets_AbstractOperation.h"
22 #include "include/Beatmup_NNets_DeserializedModel.h"
23 #include "include/Beatmup_NNets_InferenceTask.h"
24 #include "include/Beatmup_NNets_ImageSampler.h"
25 #include "include/Beatmup_NNets_Model.h"
26 #include "include/Beatmup_NNets_Softmax.h"
40 JNIMETHOD(jstring, serializeToString, Java_Beatmup_NNets_Model, serializeToString)
45 return jenv->NewStringUTF(model->serializeToString().c_str());
49 JNIMETHOD(
jlong, countMultiplyAdds, Java_Beatmup_NNets_Model, countMultiplyAdds)
54 return (
jlong)model->countMultiplyAdds();
58 JNIMETHOD(
jlong, getMemorySize, Java_Beatmup_NNets_Model, getMemorySize)
63 return (
jlong)model->getMemorySize();
67 JNIMETHOD(
jlong, getNumberOfOperations, Java_Beatmup_NNets_Model, getNumberOfOperations)
72 return (
jlong)model->getNumberOfOperations();
79 JNIMETHOD(
jlong, newDeserializedModel, Java_Beatmup_NNets_DeserializedModel, newDeserializedModel)
97 JNIMETHOD(jstring, getName, Java_Beatmup_NNets_AbstractOperation, getName)
102 return jenv->NewStringUTF(
op->getName().c_str());
106 JNIMETHOD(
jlong, countMultiplyAdds, Java_Beatmup_NNets_AbstractOperation, countMultiplyAdds)
111 return (
jlong)
op->countMultiplyAdds();
115 JNIMETHOD(
jlong, getOperationFromModel, Java_Beatmup_NNets_AbstractOperation, getOperationFromModel)
122 return (
jlong)&model->getOperation(nameStr);
134 JNIMETHOD(jfloatArray, getProbabilities, Java_Beatmup_NNets_Softmax, getProbabilities)
139 const auto&
proba = softmax->getProbabilities();
142 for (
size_t i = 0; i <
proba.size(); ++i)
161 JNIMETHOD(jint, getRotation, Java_Beatmup_NNets_ImageSampler, getRotation)
166 return (jint)imageSampler->getRotation();
173 JNIMETHOD(
jlong, newInferenceTask, Java_Beatmup_NNets_InferenceTask, newInferenceTask)
186 JNIMETHOD(
void, connectByName, Java_Beatmup_NNets_InferenceTask, connectByName)
202 JNIMETHOD(
void, connectByHandle, Java_Beatmup_NNets_InferenceTask, connectByHandle)
static void throwToJava(JNIEnv *jenv, const char *exceptionClass, const char *message)
Throws a specific exception.
void addJavaReference(JNIEnv *jenv, jobject jobj, const Beatmup::Object *bobj)
Creates new global reference on a Java object to avoid garbage collecting.
static const jlong INVALID_HANDLE
A very basic class for any image.
A key-value pair set storing pieces of arbitrary data (chunks) under string keys.
virtual const char * what() const NOEXCEPT override
Abstract neural net operation (layer).
Model reconstructed from a serialized representation.
Image preprocessing operation.
Task running inference of a Model.
void connect(AbstractBitmap &image, AbstractOperation &operation, int inputIndex=0)
Connects an image to a specific operation input.
#define JNIMETHOD(R, N, C, O)
BeatmupJavaObjectPool $pool
JNIEnv jlong jstring name
JNIEnv jobject jobject jData
JNIEnv jlong jint rotation
JNIEnv jobject jstring str
BEATMUP_CATCH({ auto model=new Beatmup::NNets::DeserializedModel(*ctx, strStr); $pool.addJavaReference(jenv, jCtx, model);return(jlong) model;})
JNIEnv jlong jobject jBitmap
JNIEnv jlong jobject jstring jint index
JNIEnv jlong jobject jlong hOp
JNIEnv jlong jobject jstring opName
BEATMUP_OBJ(Beatmup::NNets::Model, model, handle)
Beatmup::NNets::InferenceTask * task
imageSampler setRotation((int) rotation)
task connect * bitmap(int) index