ailia  1.5.0.0
Public Member Functions | Protected Member Functions | List of all members
ailia.AiliaClassifierModel Class Reference
Inheritance diagram for ailia.AiliaClassifierModel:
Inheritance graph
[legend]
Collaboration diagram for ailia.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 ailia.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 ailia.AiliaModel
IntPtr ailia = IntPtr.Zero
 
bool logging = true
 
- Properties inherited from ailia.AiliaModel
int Status [get, protected set]
 Status code @detail Get the library status code. More...
 

Member Function Documentation

◆ Close()

override void ailia.AiliaClassifierModel.Close ( )
inlinevirtual

Destroy the classification object.

Returns
Return nothing.


Destroys the classification object.

Reimplemented from ailia.AiliaModel.

325  {
326  if(ailia_classifier!=IntPtr.Zero){
327  AiliaClassifier.ailiaDestroyClassifier(ailia_classifier);
328  ailia_classifier=IntPtr.Zero;
329  }
330  base.Close();
331  }

◆ ComputeFromImage()

List<AiliaClassifier.AILIAClassifierClass> ailia.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.

212  {
213  return ComputeFromImageWithFormat(image,image_width,image_height,max_class_count,AiliaFormat.AILIA_IMAGE_FORMAT_RGBA);
214  }

◆ ComputeFromImageB2T()

List<AiliaClassifier.AILIAClassifierClass> ailia.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.

240  {
241  return ComputeFromImageWithFormat(image,image_width,image_height,max_class_count,AiliaFormat.AILIA_IMAGE_FORMAT_RGBA_B2T);
242  }

◆ Dispose() [1/2]

override void ailia.AiliaClassifierModel.Dispose ( )
inlinevirtual

Release resources.

Reimplemented from ailia.AiliaModel.

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

◆ Dispose() [2/2]

override void ailia.AiliaClassifierModel.Dispose ( bool  disposing)
inlineprotectedvirtual

Reimplemented from ailia.AiliaModel.

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

◆ OpenEx()

override bool ailia.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 ailia.AiliaModel.

115  {
116  Close();
117  bool status=base.OpenEx(callback,arg1,arg2);
118  if(status==false){
119  if(logging){
120  Debug.Log("ailiaModelOpenEx failed");
121  }
122  return false;
123  }
124  return OpenClassifier();
125  }
bool logging
Definition: AiliaModel.cs:33

◆ OpenFile()

override bool ailia.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 ailia.AiliaModel.

80  {
81  Close();
82  bool status=base.OpenFile(prototxt,model_path);
83  if(status==false){
84  if(logging){
85  Debug.Log("ailiaModelOpenFile failed");
86  }
87  return false;
88  }
89  return OpenClassifier();
90  }

◆ OpenMem()

override bool ailia.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 ailia.AiliaModel.

148  {
149  Close();
150  bool status=base.OpenMem(prototxt_buf,model_buf);
151  if(status==false){
152  if(logging){
153  Debug.Log("ailiaModelOpenMem failed");
154  }
155  return false;
156  }
157  return OpenClassifier();
158  }

◆ Settings()

bool ailia.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.

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

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