ailia  1.3.0.0
Public Member Functions | Protected Member Functions | List of all members
AiliaClassifierModel Class Reference
Inheritance diagram for AiliaClassifierModel:
Inheritance graph
[legend]
Collaboration diagram for AiliaClassifierModel:
Collaboration graph
[legend]

Public Member Functions

bool Settings (uint set_format, uint set_channel, uint set_range)
 Model setting. More...
 
override bool OpenFile (string prototxt, string model_path)
 Create a network object from a model file. More...
 
override bool OpenEx (Ailia.ailiaFileCallback callback, IntPtr arg1, IntPtr arg2)
 Creates a network object from a file callback. More...
 
override bool OpenMem (byte[] prototxt_buf, byte[] model_buf)
 Creates network objects from memory. More...
 
List< AiliaClassifier.AILIAClassifierClassComputeFromImage (Color32 [] image, int image_width, int image_height, uint max_class_count)
 Performs object classification from images. More...
 
List< AiliaClassifier.AILIAClassifierClassComputeFromImageB2T (Color32 [] image, int image_width, int image_height, uint max_class_count)
 OPerforms object classification from bottom-top images. More...
 
override void Close ()
 Destroy the classification object. More...
 
override void Dispose ()
 Release resources. More...
 
- Public Member Functions inherited from AiliaModel
bool Environment (int type)
 Selects the specified type of calculation environment. More...
 
string EnvironmentName ()
 Displays the name of the selected environment. More...
 
int GetEnvironmentCount ()
 Get the number of available computing environments (CPU, GPU). More...
 
Ailia.AILIAEnvironment GetEnvironment (int idx)
 Obtains the computing environment for the specified index. More...
 
bool SelectEnvironment (int idx)
 Select the calculation environment. More...
 
Ailia.AILIAEnvironment GetSelectedEnvironment ()
 Retrieves the selected computing environment. More...
 
void SetMemoryMode (uint set_memory_mode)
 Sets the memory mode. More...
 
void DisableLayerFusion ()
 Disables speedup due to layer fusion. More...
 
bool Predict (float[] output_data, float[] input_data)
 Perform inference and obtain inference results. More...
 
Ailia.AILIAShape GetInputShape ()
 
uint [] GetInputShapeND ()
 Obtains the shape of the input data at the time of inference. More...
 
bool SetInputShape (Ailia.AILIAShape shape)
 Sets the shape of the input data during inference. More...
 
bool SetInputShapeND (uint[] shape, int dim)
 Change the shape of the input data during inference. More...
 
Ailia.AILIAShape GetOutputShape ()
 Obtains the shape of the output data during inference. More...
 
uint [] GetOutputShapeND ()
 Obtains the shape of the output data during inference. More...
 
Ailia.AILIAShape GetBlobShape (string layer_name)
 Obtains the shape (layer format) of the internal data (Blob) at the time of inference. (Obsolete) More...
 
int FindBlobIndexByName (string name)
 Look up and retrieve the index of the internal data (Blob) at the time of inference by name. More...
 
Ailia.AILIAShape GetBlobShape (uint idx)
 Obtains the shape (layer format) of the internal data (Blob) at the time of inference. More...
 
Ailia.AILIAShape GetBlobShape (int idx)
 
bool GetBlobData (float[] output_data, uint idx)
 Obtains internal data (Blob) at the time of inference. More...
 
bool GetBlobData (float[] output_data, int idx)
 
bool SetInputBlobData (float[] input_data, uint idx)
 Set input data to the specified Blob. More...
 
bool SetInputBlobData (float[] input_data, int idx)
 
bool SetInputBlobShape (Ailia.AILIAShape shape, uint idx)
 Sets the format of the specified input data (Blob). (4 dimensions or less) More...
 
bool SetInputBlobShape (Ailia.AILIAShape shape, int idx)
 
bool SetInputBlobShapeND (uint[] shape, uint dim, uint idx)
 Sets the format of the input data (Blob). (5D or more) More...
 
bool SetInputBlobShapeND (uint[] shape, int dim, int idx)
 
uint [] GetInputBlobList ()
 Obtains a list of the indices of the input data (Blob). More...
 
uint [] GetOutputBlobList ()
 Obtains a list of indices of the output data (Blob). More...
 
bool CopyBlobData (uint dst_blob_idx, uint src_blob_idx, AiliaModel src_model=null)
 Perform copies between blobs that specified. More...
 
bool Update ()
 Inference is performed with pre-populated data. More...
 
string GetStatusString (int status)
 Returns a string corresponding to the status code. More...
 
string GetErrorDetail ()
 Returns error details. More...
 
bool SetProfileMode (uint profile_mode)
 Enable profile mode. More...
 
string GetSummary ()
 Obtain network information and profile results. More...
 

Protected Member Functions

override void Dispose (bool disposing)
 

Additional Inherited Members

- Protected Attributes inherited from AiliaModel
IntPtr ailia = IntPtr.Zero
 
bool logging = true
 
- Properties inherited from AiliaModel
int Status [get, protected set]
 Status code Get the library status code. More...
 

Member Function Documentation

◆ Close()

override void AiliaClassifierModel.Close ( )
inlinevirtual

Destroy the classification object.

Returns
Return nothing.

Destroys the classification object.

Reimplemented from AiliaModel.

324  {
325  if(ailia_classifier!=IntPtr.Zero){
326  AiliaClassifier.ailiaDestroyClassifier(ailia_classifier);
327  ailia_classifier=IntPtr.Zero;
328  }
329  base.Close();
330  }
static void ailiaDestroyClassifier(IntPtr classifier)
Destroy the identification object.
Definition: AiliaClassifier.cs:20

◆ ComputeFromImage()

List<AiliaClassifier.AILIAClassifierClass> AiliaClassifierModel.ComputeFromImage ( Color32 []  image,
int  image_width,
int  image_height,
uint  max_class_count 
)
inline

Performs object classification from images.

Parameters
imageImage to be classify
image_widthImage width
image_heightImage height
max_class_countMaximum number of classification results
Returns
List of objects resulting from the classification.

Performs object classification from an image and returns a list.

211  {
212  return ComputeFromImageWithFormat(image,image_width,image_height,max_class_count,AiliaFormat.AILIA_IMAGE_FORMAT_RGBA);
213  }
Definition: AiliaFormat.cs:20
const Int32 AILIA_IMAGE_FORMAT_RGBA
Definition: AiliaFormat.cs:33

◆ ComputeFromImageB2T()

List<AiliaClassifier.AILIAClassifierClass> AiliaClassifierModel.ComputeFromImageB2T ( Color32 []  image,
int  image_width,
int  image_height,
uint  max_class_count 
)
inline

OPerforms object classification from bottom-top images.

Parameters
imageImage to be classify
image_widthImage width
image_heightImage height
max_class_countMaximum number of classification results
Returns
List of objects resulting from the classification.

Performs object classification from an image and returns a list.

239  {
240  return ComputeFromImageWithFormat(image,image_width,image_height,max_class_count,AiliaFormat.AILIA_IMAGE_FORMAT_RGBA_B2T);
241  }
Definition: AiliaFormat.cs:20
const Int32 AILIA_IMAGE_FORMAT_RGBA_B2T
Definition: AiliaFormat.cs:50

◆ Dispose() [1/2]

override void AiliaClassifierModel.Dispose ( )
inlinevirtual

Release resources.

Reimplemented from AiliaModel.

340  {
341  Dispose(true);
342  }
override void Dispose()
Release resources.
Definition: AiliaClassifierModel.cs:339

◆ Dispose() [2/2]

override void AiliaClassifierModel.Dispose ( bool  disposing)
inlineprotectedvirtual

Reimplemented from AiliaModel.

345  {
346  if (disposing){
347  // release managed resource
348  }
349  Close(); // release unmanaged resource
350  base.Dispose(disposing);
351  }
override void Close()
Destroy the classification object.
Definition: AiliaClassifierModel.cs:324

◆ OpenEx()

override bool AiliaClassifierModel.OpenEx ( Ailia.ailiaFileCallback  callback,
IntPtr  arg1,
IntPtr  arg2 
)
inlinevirtual

Creates a network object from a file callback.

Parameters
callbackUser-defined file access callback function structure
alg1Argument pointer notified to AILIA_USER_API_FOPEN
alg2Argument pointer notified to AILIA_USER_API_FOPEN
Returns
If this function is successful, it returns true , or false otherwise.

 Creates a network object from a file callback.

Reimplemented from AiliaModel.

114  {
115  Close();
116  bool status=base.OpenEx(callback,arg1,arg2);
117  if(status==false){
118  if(logging){
119  Debug.Log("ailiaModelOpenEx failed");
120  }
121  return false;
122  }
123  return OpenClassifier();
124  }
bool logging
Definition: AiliaModel.cs:32
override void Close()
Destroy the classification object.
Definition: AiliaClassifierModel.cs:324

◆ OpenFile()

override bool AiliaClassifierModel.OpenFile ( string  prototxt,
string  model_path 
)
inlinevirtual

Create a network object from a model file.

Parameters
prototxtPath name of the prototxt file (MBSC or UTF16)
model_pathPathname of the protobuf/onnx file (MBSC or UTF16)
Returns
If this function is successful, it returns true , or false otherwise.

Create a network object from a model file.

Reimplemented from AiliaModel.

79  {
80  Close();
81  bool status=base.OpenFile(prototxt,model_path);
82  if(status==false){
83  if(logging){
84  Debug.Log("ailiaModelOpenFile failed");
85  }
86  return false;
87  }
88  return OpenClassifier();
89  }
bool logging
Definition: AiliaModel.cs:32
override void Close()
Destroy the classification object.
Definition: AiliaClassifierModel.cs:324

◆ OpenMem()

override bool AiliaClassifierModel.OpenMem ( byte []  prototxt_buf,
byte []  model_buf 
)
inlinevirtual

Creates network objects from memory.

Parameters
prototxtPointer to data in prototxt file
model_pathPointer to data in protobuf/onnx file
Returns
If this function is successful, it returns true , or false otherwise.

Creates network objects from memory.

Reimplemented from AiliaModel.

147  {
148  Close();
149  bool status=base.OpenMem(prototxt_buf,model_buf);
150  if(status==false){
151  if(logging){
152  Debug.Log("ailiaModelOpenMem failed");
153  }
154  return false;
155  }
156  return OpenClassifier();
157  }
bool logging
Definition: AiliaModel.cs:32
override void Close()
Destroy the classification object.
Definition: AiliaClassifierModel.cs:324

◆ Settings()

bool AiliaClassifierModel.Settings ( uint  set_format,
uint  set_channel,
uint  set_range 
)
inline

Model setting.

Parameters
set_formatThe network image format (AILIA_NETWORK_IMAGE_FORMAT_*)
set_channelThe network image channel (AILIA_NETWORK_IMAGE_CHANNEL_*)
set_rangeThe network image range (AILIA_NETWORK_IMAGE_RANGE_*)
Returns
If this funcyion is successful, it returns true.

Configure the necessary image preprocessing settings.

51  {
52  format=set_format;
53  channel=set_channel;
54  range=set_range;
55  return true;
56  }

The documentation for this class was generated from the following file: