JP7700501B2 - Inference device, inference method, and program - Google Patents
Inference device, inference method, and program Download PDFInfo
- Publication number
- JP7700501B2 JP7700501B2 JP2021074174A JP2021074174A JP7700501B2 JP 7700501 B2 JP7700501 B2 JP 7700501B2 JP 2021074174 A JP2021074174 A JP 2021074174A JP 2021074174 A JP2021074174 A JP 2021074174A JP 7700501 B2 JP7700501 B2 JP 7700501B2
- Authority
- JP
- Japan
- Prior art keywords
- inference
- model
- recognition
- result
- image
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Image Analysis (AREA)
Description
本発明は、推論装置、推論方法、及びプログラムに関する。 The present invention relates to an inference device, an inference method, and a program.
画像認識等といった様々なタスクを機械学習モデルにより実行することが従来から行われている。また、或るタスクを実行する際に、複数の機械学習モデルの中から適切な機械学習モデルを選択することも従来から行われている。例えば、特許文献1には、複数のCNN(Convolutional Neural Network)モデルの中からデータベースに適するCNNモデルを選択する技術が開示されている。
Various tasks such as image recognition have traditionally been performed using machine learning models. In addition, when performing a certain task, it has also been traditional to select an appropriate machine learning model from among multiple machine learning models. For example,
しかしながら、CNNモデルは、RAM(Random Access Memory)等といったハードウェアリソースの使用量が多いことが一般的である。このため、特許文献1では、複数のCNNモデルの中からどのCNNモデルを選んだとしても、ハードウェアリソースの使用量を大きく削減させることは期待できないと考えられる。また、特許文献1では、推論を実行する前にCNNモデルを選択しており、推論時に動的にCNNモデルを変更することはできない。
However, CNN models generally use a large amount of hardware resources such as RAM (Random Access Memory). For this reason, in
一方で、推論時の状況によっては、CNNモデル等の汎用的な機械学習モデルだけでなく、より軽量で特定の状況に特化した機械学習モデルを適用可能な場合がある。このため、推論時の状況が特定の状況のときには、当該状況に特化した軽量な機械学習モデルにより推論を行うことで、ハードウェアリソースの使用量を大きく削減できると考えられる。また、推論時の状況は刻々と変化し得るため、推論に使用する機械学習モデルを動的に変更できることが好ましいと考えられる。 On the other hand, depending on the situation during inference, it may be possible to apply not only general-purpose machine learning models such as CNN models, but also lighter machine learning models specialized for specific situations. For this reason, when the situation during inference is specific, it is believed that the amount of hardware resources used can be significantly reduced by performing inference using a lightweight machine learning model specialized for that situation. Furthermore, since the situation during inference can change from moment to moment, it is considered preferable to be able to dynamically change the machine learning model used for inference.
本発明の一実施形態は、上記の点に鑑みてなされたもので、推論時の状況に応じて複数のモデルの中から適切なモデルを動的に選択することを目的とする。 One embodiment of the present invention has been made in consideration of the above points, and aims to dynamically select an appropriate model from among multiple models depending on the situation at the time of inference.
上記目的を達成するため、一実施形態に係る推論装置は、複数のデータの各々に対して所定のタスクの推論を繰り返し実行する推論装置であって、複数のモデルの中から選択されたモデルを示す選択モデルにより、前記データに対して前記タスクの推論を実行する推論部と、前記推論の結果に基づいて、次の繰り返しにおける推論を実行する選択モデルを前記複数のモデルの中から選択する選択部と、を有する。 To achieve the above object, an inference device according to one embodiment is an inference device that repeatedly executes inference of a predetermined task for each of a plurality of data, and has an inference unit that executes inference of the task for the data using a selection model indicating a model selected from a plurality of models, and a selection unit that selects a selection model from the plurality of models for executing inference in the next iteration based on the result of the inference.
推論時の状況に応じて複数のモデルの中から適切なモデルを動的に選択することができる。 The appropriate model can be dynamically selected from multiple models depending on the situation at the time of inference.
以下、本発明の一実施形態について説明する。本実施形態では、画像中の物体の種類とその位置を認識する画像認識タスクを対象として、当該タスクの推論時の状況に応じて複数のモデルの中から適切なモデルを動的に選択した上で、この選択したモデルに切り替えて推論を行うことが可能な動的モデル切替推論装置10について説明する。なお、本実施形態では、モデルとは、画像認識タスクに適用可能な機械学習モデル(画像認識モデル)又は画像認識手法のことを意味する。
One embodiment of the present invention will be described below. In this embodiment, a dynamic model
ここで、本実施形態では、各モデルは、画像中の物体の種類(物体種類)とその物体の画像中の位置(画像中位置)とを認識すると共に、その認識率を算出するものとする。言い換えれば、各モデルは、認識率と、物体種類と、画像中位置とを出力するものとする。認識率とはモデルによる特徴の認識精度を表す指標値であり、例えば、モデルによって出力された物体種類及び画像中位置の確からしさを表している。 In this embodiment, each model recognizes the type of object in an image (object type) and the position of the object in the image (image position), and calculates the recognition rate. In other words, each model outputs the recognition rate, object type, and image position. The recognition rate is an index value that represents the accuracy of feature recognition by the model, and represents, for example, the accuracy of the object type and image position output by the model.
なお、物体種類や画像中位置はモデルによって認識される画像中の特徴であるため、以下では、物体種類及び画像中位置をそれぞれ「特徴」ともいう。また、認識率、物体種類及び画像中位置はモデルの認識状態を表す変数であるため、認識率、物体種類、及び画像中位置をそれぞれ「状態変数」ともいう。 Note that, since the object type and the position in the image are features in the image recognized by the model, hereinafter, the object type and the position in the image are also referred to as "features", respectively. Furthermore, since the recognition rate, the object type, and the position in the image are variables that represent the recognition state of the model, the recognition rate, the object type, and the position in the image are also referred to as "state variables", respectively.
ただし、認識率、物体種類、画像中位置以外にも、画像認識タスクにおけるモデルの認識状態を表す様々な変数を状態変数としてもよい。例えば、撮像装置から物体までの距離、画像認識の認識率に影響を与える条件(例えば、撮影環境における照明条件、1日における時刻等)といったものを表す変数を状態変数としてもよい。 However, in addition to the recognition rate, object type, and position in the image, various variables that represent the recognition state of the model in the image recognition task may be used as state variables. For example, variables that represent the distance from the imaging device to the object, conditions that affect the recognition rate of image recognition (e.g., lighting conditions in the shooting environment, time of day, etc.) may be used as state variables.
<動的モデル切替推論装置10のハードウェア構成>
まず、本実施形態に係る動的モデル切替推論装置10のハードウェア構成について、図1を参照しながら説明する。図1は、本実施形態に係る動的モデル切替推論装置10のハードウェア構成の一例を示す図である。
<Hardware Configuration of the Dynamic Model
First, a hardware configuration of a dynamic model
図1に示すように、本実施形態に係る動的モデル切替推論装置10は一般的なコンピュータ又はコンピュータシステムで実現され、入力装置101と、表示装置102と、外部I/F103と、通信I/F104と、プロセッサ105と、メモリ装置106とを有する。これら各ハードウェアは、それぞれがバス107を介して通信可能に接続されている。
As shown in FIG. 1, the dynamic model
入力装置101は、例えば、キーボードやマウス、タッチパネル等である。表示装置102は、例えば、ディスプレイ等である。なお、動的モデル切替推論装置10は、入力装置101及び表示装置102のうちの少なくとも一方を有していなくてもよい。
The
外部I/F103は、記録媒体103a等の外部装置とのインタフェースである。動的モデル切替推論装置10は、外部I/F103を介して、記録媒体103aの読み取りや書き込み等を行うことができる。なお、記録媒体103aとしては、例えば、CD(Compact Disc)、DVD(Digital Versatile Disk)、SDメモリカード(Secure Digital memory card)、USB(Universal Serial Bus)メモリカード等がある。
The external I/
通信I/F104は、動的モデル切替推論装置10を通信ネットワークに接続するためのインタフェースである。プロセッサ105は、例えば、CPU(Central Processing Unit)やGPU(Graphics Processing Unit)等の各種演算装置である。メモリ装置106は、例えば、HDD(Hard Disk Drive)やSSD(Solid State Drive)、RAM、ROM(Read Only Memory)、フラッシュメモリ等の各種記憶装置である。
The communication I/
本実施形態に係る動的モデル切替推論装置10は、図1に示すハードウェア構成を有することにより、後述する動的モデル切替推論処理を実現することができる。なお、図1に示すハードウェア構成は一例であって、動的モデル切替推論装置10は、他のハードウェア構成を有していてもよい。例えば、動的モデル切替推論装置10は、複数のプロセッサ105を有していてもよいし、複数のメモリ装置106を有していてもよい。
The dynamic model
また、本実施形態に係る動的モデル切替推論装置10は、例えば、一般的なコンピュータ又はコンピュータシステムと比べてハードウェアリソースに制約がある組み込み機器等であってもよい。
The dynamic model
<動的モデル切替推論装置10の機能構成>
次に、本実施形態に係る動的モデル切替推論装置10の機能構成について、図2を参照しながら説明する。図2は、本実施形態に係る動的モデル切替推論装置10の機能構成の一例を示す図である。
<Functional configuration of the dynamic model
Next, the functional configuration of the dynamic model
図2に示すように、本実施形態に係る動的モデル切替推論装置10は、推論部201と、状態変数取得部202と、認識状態パターン判定部203と、モデル選択部204とを有する。これら各部は、例えば、動的モデル切替推論装置10にインストールされた1以上のプログラムが、プロセッサ105に実行させる処理により実現される。
As shown in FIG. 2, the dynamic model
また、本実施形態に係る動的モデル切替推論装置10は、記憶部205を有する。記憶部205は、例えば、メモリ装置106により実現される。なお、記憶部205は、例えば、動的モデル切替推論装置10と通信ネットワークを介して接続されるデータベースサーバ等により実現されてもよい。
The dynamic model
推論部201は、画像データを入力として、モデル選択部204により選択されたモデル(以下、選択モデルともいう。)により推論処理を行って、当該画像データが表す画像中の物体種類と画像中位置とを認識すると共に、その認識率を算出する。
The
状態変数取得部202は、推論部201による推論結果(つまり、認識率、物体種類、画像中位置)を表す状態変数値を取得する。
The state
認識状態パターン判定部203は、記憶部205に記憶されている認識状態パターン情報を参照して、状態変数取得部202により取得された状態変数値(及びその変化)から現在の認識状態パターンを判定する。ここで、認識状態パターンとは推論時の状況を表すパターンのことであり、後述するように、例えば、認識率が高い/低い、物体種類の変化が大きい/小さい、画像中位置の変化が大きい/小さいの組み合わせによって定義される。なお、認識状態パターン情報の詳細については後述する。
The recognition state
モデル選択部204は、記憶部205に記憶されているモデル種類情報を参照して、認識状態パターン判定部203により判定された認識状態パターンから選択モデルを決定する。ここで、モデル種類情報とは、認識状態パターン毎に、その認識状態パターンに対して適切なモデルが定義された情報である。適切なモデルとは、例えば、該当の認識状態パターンにおいて、高い精度で、かつ、軽量に画像認識が可能なモデルのこと(つまり、当該認識状態パターンに特化した軽量なモデルのこと)である。なお、モデル種類情報の詳細については後述する。
The
記憶部205は、各種情報(例えば、認識状態パターン情報やモデル種類情報、各モデルのモデルデータ等)を記憶する。なお、記憶部205には、認識状態パターン情報やモデル種類情報、モデルデータ以外にも、後述する動的モデル切替推論処理の実行に必要な様々な情報が記憶される。
The
≪認識状態パターン情報≫
次に、記憶部205に記憶されている認識状態パターン情報の一例について、図3を参照しながら説明する。図3は、認識状態パターン情報の一例を示す図である。
<Recognition status pattern information>
Next, an example of the recognition state pattern information stored in the
図3に示す認識状態パターン情報には、認識率と物体種類の変化と画像中位置の変化との組み合わせに応じた5つの認識状態パターンが定義されている。ここで、物体種類の変化とは、現在の時刻と1つ前の時刻との間における物体種類の値の変化のことである。同様に、画像中位置の変化とは、現在の時刻と1つ前の時刻との間における画像中位置の値の変化のことである。なお、図3中における「×」は認識率が低い、物体種類の変化が大きい、画像中位置の変化が大きいことを表し、「〇」は認識率が高い、物体種類の変化が小さい、画像中位置の大きいことを表す。また、「-」は定義されないことを意味する。 The recognition state pattern information shown in Figure 3 defines five recognition state patterns according to combinations of recognition rate, change in object type, and change in position in the image. Here, a change in object type refers to the change in the value of the object type between the current time and the previous time. Similarly, a change in position in the image refers to the change in the value of the position in the image between the current time and the previous time. Note that in Figure 3, "x" indicates a low recognition rate, a large change in object type, and a large change in position in the image, while "o" indicates a high recognition rate, a small change in object type, and a large change in position in the image. Also, "-" means that it is not defined.
認識状態パターン1は、認識率が「×」である場合を表す認識状態パターンである。この場合、物体種類の変化と画像中位置の変化は定義されない。これは、認識率が低い場合は、物体種類及び画像中位置が正しくない可能性が高いためである。
認識状態パターン2は、認識率が「〇」、物体種類の変化が「×」、画像中位置の変化が「×」である場合を表す認識状態パターンである。認識状態パターン3は、認識率が「〇」、物体種類の変化が「×」、画像中位置の変化が「〇」である場合を表す認識状態パターンである。認識状態パターン4は、認識率が「〇」、物体種類の変化が「〇」、画像中位置の変化が「×」である場合を表す認識状態パターンである。認識状態パターン5は、認識率が「〇」、物体種類の変化が「〇」、画像中位置の変化が「〇」である場合を表す認識状態パターンである。
なお、図3に示す例では、認識率が「×」の場合は認識状態パターン1のみとしたが、この認識状態パターン1は更に細分化されてもよい。すなわち、認識率「×」、物体種類の変化「×」、画像中位置の変化「×」である認識状態パターン1-1、認識率「×」、物体種類の変化「〇」、画像中位置の変化「×」である認識状態パターン1-2、認識率「×」、物体種類の変化「〇」、画像中位置の変化「×」である認識状態パターン1-3、認識率「×」、物体種類の変化「〇」、画像中位置の変化「〇」である認識状態パターン1-4と細分化されてもよい。
In the example shown in FIG. 3, only
また、図3に示す例では、認識率が高い/低い、物体種類の変化と画像中位置の変化が大きい/小さいの組み合わせとしたが、更に細分化されてもよい。すなわち、例えば、認識率が高い/中程度/低いと3つに細分化されてもよい。同様に、物体種類の変化と画像中位置の変化の少なくとも一方が大きい/中程度/小さいと3つに細分化されてもよい。ただし、3つに細分化することは一例であって、更に細かく細分化(つまり、4つ以上に細分化)されてもよい。 In the example shown in FIG. 3, the recognition rate is a combination of high/low and large/small change in object type and position in the image, but this may be further subdivided. That is, for example, the recognition rate may be subdivided into three categories: high/medium/low. Similarly, at least one of the change in object type and the change in position in the image may be subdivided into three categories: large/medium/small. However, subdivision into three categories is just one example, and further subdivision (i.e., four or more categories) may be used.
また、図3に示す例は、認識率、物体種類及び画像中位置の3つが状態変数である場合の認識状態パターンの一例であり、状態変数の数が増えれば認識状態パターン数も増加し得る。 The example shown in Figure 3 is an example of a recognition state pattern when the three state variables are the recognition rate, object type, and position in the image, and the number of recognition state patterns can increase as the number of state variables increases.
≪モデル種類情報≫
次に、記憶部205に記憶されているモデル種類情報の一例について、図4を参照しながら説明する。図4は、モデル種類情報の一例を示す図である。
<Model type information>
Next, an example of the model type information stored in the
図4に示すモデル種類情報には、認識状態パターン1~認識状態パターン5の各々に対して適切なモデルA~モデルEが定義されている。
The model type information shown in Figure 4 defines appropriate models A to E for each of
認識状態パターン1は、認識率が低い認識状態パターンである。このため、認識状態パターン1に対しては、複数の特徴(物体種類と画像中位置)を高い精度で認識可能な汎用的なモデルAを適切なモデルとする。ここで、モデルAとしては、例えば、特徴量を自動で抽出するようなモデルと、着目する特徴量を手動で選定又は選択して、複数の特徴量を組み合わせるモデルとが存在する。前者のモデルとしては、例えば、CNNモデル等が挙げられる。一方で、後者のモデルとしては、SIFT(Scale-Invariant Feature Transform)特徴量やHOG(Histgram Of Gradient)特徴量等といった複数の特徴量を組み合わせたモデル等が挙げられる。なお、認識状態パターン1ではCNNモデル等の汎用的なモデルAが用いられるため、ハードウェアリソースの使用量削減の効果は期待できない。これは、認識状態パターン1ではハードウェアリソースの使用量削減よりも、認識性能の向上を優先すべきためである。
認識状態パターン2~認識状態パターン4は、認識率は高い一方で、特定の特徴の変化が大きい認識状態パターンである。
認識状態パターン2は、物体種類と画像中位置の両方の変化が大きいため、これら両方の特徴を軽量に認識可能なモデルBを適切なモデルとする。モデルBとしては、例えば、SIFT特徴量を使用した画像認識モデル又は画像認識手法、SURF(Speeded-Up Robust Features)特徴量を使用した画像認識モデル又は画像認識手法等が挙げられる。ただし、認識状態パターン2は物体種類と画像中位置の両方の変化が大きいため、CNNモデルをモデルBとしてもよいし、CNNモデルと同等の認識性能を持つ画像認識モデル等をモデルBとしてもよい。
For
認識状態パターン3は、物体種類の変化が大きいため、物体種類を軽量に認識可能なモデルCを適切なモデルとする。モデルCとしては、例えば、SIFT特徴量を使用した画像認識モデル又は画像認識手法、HOG特徴量を使用した画像認識モデル又は画像認識手法等が挙げられる。
For
なお、SIFT特徴量を使用した画像認識モデル又は画像認識手法は細かな特徴の把握に優れていることが知られている一方で、HOG特徴量を使用した画像認識モデル又は画像認識手法は大まかな特徴の把握に優れていることが知られている。このため、例えば、同一物品の物体における種類を認識する場合(例えば、カップにおける絵柄の種類を認識する場合等)はSIFT特徴量を使用した画像認識モデル又は画像認識手法が優れている。一方で、例えば、物体の物品種類を認識する場合(例えば、物品がカップか否かを認識する場合等)はHOG特徴量を使用した画像認識モデル又は画像認識手法が優れている。 It is known that image recognition models or methods using SIFT features are excellent at grasping fine features, while image recognition models or methods using HOG features are excellent at grasping rough features. For this reason, for example, when recognizing the type of object of the same item (for example, when recognizing the type of pattern on a cup, etc.), an image recognition model or method using SIFT features is superior. On the other hand, for example, when recognizing the type of object (for example, when recognizing whether the object is a cup or not), an image recognition model or method using HOG features is superior.
認識状態パターン4は、画像中位置の変化が大きいため、画像中位置を軽量に認識可能なモデルDを適切なモデルとする。ここで、軽量に認識可能なモデル(以下、軽量モデルともいう。)とは、特定の特徴量の認識に特化し、省リソースで画像認識が可能なモデルのことをいう。モデルDとしては、例えば、SURF特徴量を使用した画像認識モデル又は画像認識手法、HOG特徴量を使用した画像認識モデル又は画像認識手法等が挙げられる。
Because
認識状態パターン5は、認識率が高く、かつ、各特徴の変化も小さい認識状態パターンである。この場合は、最も軽量なモデルEを適切なモデルとする。モデルEとしては、例えば、SURF特徴量を使用した画像認識モデル又は画像認識手法等が挙げられる。ただし、これ以外に、軽量な画像認識モデル又は画像認識手法をモデルEとしてもよい。
なお、モデルA~モデルEの全てが異なるモデルである必要はなく、一部のモデルが同一のモデルであってもよい。例えば、モデルDとモデルEが共にSURF特徴量を使用した画像認識モデル又は画像認識手法であってもよい。 Note that it is not necessary for all of models A to E to be different models, and some of the models may be the same model. For example, models D and E may both be image recognition models or image recognition methods that use SURF features.
また、上記の各モデルの具体例は一例であって、上述したSIFT特徴量、SURF特徴量又はHOG特徴量を使用した画像認識モデル又は画像認識手法以外にも、様々な画像認識モデル又は画像認識手法を用いることが可能である。例えば、Haar-like特徴量、テンプレートマッチング等といった画像認識手法が用いられてもよい。 The specific examples of each model above are merely examples, and various image recognition models or methods can be used in addition to the image recognition models or methods using the above-mentioned SIFT features, SURF features, or HOG features. For example, image recognition methods such as Haar-like features, template matching, etc. may be used.
<動的モデル切替推論処理>
次に、本実施形態に係る動的モデル切替処理について、図5を参照しながら説明する。図5は、動的モデル切替推論処理の流れの一例を示すフローチャートである。なお、以下では、時刻を表すインデックスをtとして、或る時刻tにおける動的モデル切替処理について説明する。
<Dynamic model switching inference processing>
Next, the dynamic model switching process according to this embodiment will be described with reference to Fig. 5. Fig. 5 is a flowchart showing an example of the flow of the dynamic model switching inference process. Note that, in the following, the dynamic model switching process at a certain time t will be described, where t is an index representing time.
まず、推論部201は、時刻tの画像データを取得する(ステップS101)。なお、推論部201は、動的モデル切替推論装置10と接続される他の装置又は機器(例えば、撮像装置等)から画像データを取得してもよいし、記憶部205から画像データを取得してもよい。
First, the
次に、推論部201は、上記のステップS101で取得した画像データを入力として、現在の選択モデルにより推論処理を行って、認識率と物体種類と画像中位置とを表す状態変数値を出力する(ステップS102)。この状態変数値は、時刻tにおける推論結果として記憶部205に格納される。なお、t=1のとき(つまり、最初に推論処理を行うとき)は予め決められたモデル(例えば、CNNモデル等の汎用的なモデル)を選択モデルとすればよい。
Next, the
次に、状態変数取得部202は、上記のステップS102で出力された状態変数値(つまり、時刻tにおける状態変数値)と、1つ前の時刻の状態変数値(つまり、時刻t-1における状態変数値)とを取得する(ステップS103)。
Next, the state
次に、動的モデル切替推論装置10は、モデル選択処理を実行する(ステップS104)。このモデル選択処理では、時刻tにおける状態変数値、又は、時刻tにおける状態変数値と時刻t-1における状態変数値の両方に基づいて、次の時刻t+1の推論処理で用いる選択モデルを決定する。なお、モデル選択処理の詳細については後述する。
Next, the dynamic model
次に、推論部201は、次の画像データがあるか否かを判定する(ステップS105)。そして、次の画像データがある場合は、時刻tをt+1に更新した上で(ステップS106)、推論部201は、上記のステップS101に戻る。これにより、各時刻tに対して上記のステップS101~ステップS104が繰り返し実行される。一方で、次の画像データが無い場合は、推論部201は、動的モデル切替推論処理を終了する。
Next, the
≪モデル選択処理≫
次に、上記のステップS104におけるモデル選択処理について、図6を参照しながら説明する。図6は、モデル選択処理の流れの一例を示すフローチャートである。
<Model selection process>
Next, the model selection process in step S104 will be described with reference to Fig. 6. Fig. 6 is a flow chart showing an example of the flow of the model selection process.
まず、認識状態パターン判定部203は、時刻tにおける状態変数値に含まれる認識率が所定の閾値th1以上であるか否かを判定する(ステップS201)。当該認識率が閾値th1以上である場合は認識率が高いと判定される一方で、閾値th1未満である場合は認識率が低いと判定される。ただし、例えば、閾値th11と閾値th12とを準備し、当該認識率が閾値th11以上の場合は認識率が高いと判定し、閾値th12未満の場合は認識率が低いと判定し、閾値th12以上かつ閾値th11未満の場合は時刻t-1における本ステップの判定結果と同じとしてもよい。
First, the recognition state
なお、閾値th1(又は、閾値th11と閾値th12)は予め設定した固定値としてもよいが、過去の認識率に応じた可変値としてもよい。例えば、時刻t-ΔT(ただし、ΔTは予め決められた時間幅)から時刻tまでの各時刻における認識率の平均値μ1と分散σ1を算出した上で、th11=μ1+σ1,th12=μ1-σ1としてもよい。ただし、th11が低くなり過ぎることを防止するため、例えば、予め決めたチューニング値をR'(例えば、R'=70%等)として、th11=max(μ1+σ1,R')としてもよい。 The threshold th 1 (or the thresholds th 11 and th 12 ) may be a preset fixed value, or may be a variable value according to past recognition rates. For example, after calculating the average value μ 1 and variance σ 1 of the recognition rates at each time from time t-ΔT (where ΔT is a predetermined time width) to time t, th 11 = μ 1 + σ 1 , th 12 = μ 1 - σ 1 may be used. However, in order to prevent th 11 from becoming too low, for example, a preset tuning value may be set to R' (e.g., R'=70%), and th 11 =max(μ 1 + σ 1 , R').
上記のステップS201で認識率が低いと判定された場合、認識状態パターン判定部203は、図3に示す認識状態パターン情報を参照して、現在の認識状態パターンを「認識状態パターン1」であると判定する(ステップS202)。
If the recognition rate is determined to be low in step S201 above, the recognition state
そして、モデル選択部204は、図4に示すモデル種類情報を参照して、認識状態パターン1に対応するモデルAを選択モデルとして選択する(ステップS203)。
Then, the
一方で、上記のステップS201で認識率が高いと判定された場合、認識状態パターン判定部203は、時刻t-1に対する時刻tにおける状態変数値(ただし、認識率を除く)の変化を算出する(ステップS204)。なお、認識率を除く理由は、上記のステップS201で認識率の高い/低いが判定済なためである。
On the other hand, if the recognition rate is determined to be high in step S201, the recognition state
ここで、状態変数値(ただし、認識率を除く)の変化の算出方法の一例について説明する。例えば、図7の上図に示すように、時刻t-1における画像データを入力として或る選択モデルにより推論処理を行った結果を表す状態変数値が、認識率「80%」、物体種類「0:カップ」、画像中位置「X=100,Y=150」であったものとする。また、例えば、図7の下図に示すように、時刻tにおける画像データを入力として或る選択モデルにより推論処理を行った結果を表す状態変数値が、認識率「85%」、物体種類「0:カップ」、画像中位置「X=150,Y=100」であったものとする。なお、認識率は0以上100以下の値を取り得るものとし、物体種類は物体の種類を表すカテゴリ値を取り得るものとする。また、画像中位置は画像データが表す画像の左上を原点として、右方向をX軸の正の方向、下方向をY軸の正の方向とするXY座標値を取り得るものとする。 Here, an example of a method for calculating the change in state variable values (excluding the recognition rate) will be described. For example, as shown in the upper diagram of FIG. 7, the state variable values representing the result of inference processing performed by a certain selection model using image data at time t-1 as input are a recognition rate of "80%, object type "0: cup", and position in the image "X=100, Y=150". Also, as shown in the lower diagram of FIG. 7, the state variable values representing the result of inference processing performed by a certain selection model using image data at time t as input are a recognition rate of "85%, object type "0: cup", and position in the image "X=150, Y=100". Note that the recognition rate can take a value between 0 and 100, and the object type can take a category value representing the type of object. Also, the position in the image can take an XY coordinate value with the top left corner of the image represented by the image data as the origin, with the right direction being the positive direction of the X axis and the downward direction being the positive direction of the Y axis.
このとき、認識状態パターン判定部203は、例えば、時刻tにおける物体種類と時刻t-1における物体種類が同一の場合はその変化を「0」、異なる場合はその変化を「1」とする。また、認識状態パターン判定部203は、例えば、時刻tにおける画像中位置のX座標値及びY座標値から、時刻t-1における画像中位置のX座標値及びY座標値をそれぞれ減算することで、画像中位置の変化を算出する。これにより、物体種類の変化と画像中位置の変化は、図8のようになる。すなわち、時刻t-1に対する時刻tにおける物体種類の変化は「0」、時刻t-1に対する時刻tにおける画像中位置の変化は「X=50,Y=0」となる。
At this time, the recognition state
次に、認識状態パターン判定部203は、認識率以外の状態変数値の変化に対する閾値判定を行って、その変化が大きい又は小さいのいずれであるかを判定する(ステップS205)。すなわち、認識状態パターン判定部203は、物体種類の変化が大きい又は小さいのいずれかであるか、画像中位置の変化が大きい又は小さいのいずれであるかをそれぞれ判定する。以下、物体種類の変化と画像中位置の変化のそれぞれが大きい又は小さいのいずれであるかを判定する場合の詳細について説明する。
Next, the recognition state
・物体種類の変化が大きい/小さいを判定する場合
例えば、認識状態パターン判定部203は、物体種類の変化率Rvを算出した上で、この変化率Rvが所定の閾値th2以上である場合は物体種類の変化が大きいと判定し、閾値th2未満である場合は物体種類の変化が小さいと判定する。ここで、物体種類の変化率Rvは、例えば、時刻t-ΔTから時刻tまでの間における物体種類の変化回数をn、時間幅ΔTに含まれる時刻インデックス数をNとして、Rv=(n/N)×100で算出される。
When determining whether the change in object type is large/small, for example, the recognition state
ただし、例えば、閾値th21と閾値th22とを準備し、物体種類の変化率Rvが閾値th21以上の場合は物体種類の変化が大きいと判定し、閾値th22未満の場合は物体種類の変化が小さいと判定し、閾値th21未満かつ閾値th22以上の場合は時刻t-1における本ステップの判定結果(又は、時刻t-1で本ステップが実行されていない場合は、それ以前の時刻における本ステップの最新の判定結果)と同じとしてもよい。 However, for example, thresholds th21 and th22 may be prepared, and if the rate of change Rv of the object type is equal to or greater than the threshold th21 , it may be determined that the change in the object type is large, and if it is less than the threshold th22 , it may be determined that the change in the object type is small, and if it is less than the threshold th21 and equal to or greater than the threshold th22 , it may be determined that the change in the object type is the same as the determination result of this step at time t-1 (or, if this step has not been executed at time t-1, the most recent determination result of this step at a time prior to that).
なお、閾値th2(又は、閾値th21と閾値th22)は予め設定した固定値としてもよいが、過去の変化率Rvに応じた可変値としてもよい。例えば、時刻t-ΔTから時刻tまでの各時刻における物体種類の変化率Rvの平均値μ2と分散σ2を算出した上で、th21=μ2+σ2,th22=μ2-σ2としてもよい。ただし、th21が低くなり過ぎることを防止するため、例えば、予め決めたチューニング値をRv'(例えば、Rv'=30%等)として、th21=max(μ2+σ2,Rv')としてもよい。 The threshold th 2 (or the thresholds th 21 and th 22 ) may be a preset fixed value, or may be a variable value according to the past rate of change Rv. For example, after calculating the average value μ 2 and variance σ 2 of the rate of change Rv of the object type at each time from time t-ΔT to time t, th 21 = μ 2 + σ 2 and th 22 = μ 2 - σ 2 may be set. However, in order to prevent th 21 from becoming too low, for example, a predetermined tuning value may be set to Rv' (for example, Rv' = 30%), and th 21 = max (μ 2 + σ 2 , Rv').
・画像中位置の変化が大きい/小さいを判定する場合
例えば、認識状態パターン判定部203は、画像中位置の変化率Rdを算出した上で、この変化率Rdが所定の閾値th3以上である場合は画像中位置の変化が大きいと判定し、閾値th3未満である場合は画像中位置の変化が小さいと判定する。ここで、画像中位置の変化率Rdは、例えば、時刻t-ΔTから時刻tまでの間におけるX軸方向の変化率Rdxと、時刻t-ΔTから時刻tまでの間におけるY軸方向の変化率Rdyとのいずれか高い方とする(つまり、Rd=max(Rdx,Rdy))。また、Rdxは、例えば、時刻t-ΔTから時刻tまでの間におけるX軸方向の移動量をdx、画像データが表す画像のX軸方向の総画素数をPxとして、Rdx=(dx/Px)×100で算出される。同様に、Rdyは、例えば、時刻t-ΔTから時刻tまでの間におけるY軸方向の移動量をdy、画像データが表す画像のY軸方向の総画素数をPyとして、Pdy=(dy/Py)×100で算出される。
- When determining whether the change in the position in the image is large/small For example, the recognition state
ただし、例えば、閾値th31と閾値th32とを準備し、画像中位置の変化率Rdが閾値th31以上の場合は画像中位置の変化が大きいと判定し、閾値th32未満の場合は画像中位置の変化が小さいと判定し、閾値th31未満かつ閾値th32以上の場合は時刻t-1における本ステップの判定結果(又は、時刻t-1で本ステップが実行されていない場合は、それ以前の時刻における本ステップの最新の判定結果)と同じとしてもよい。 However, for example, thresholds th31 and th32 may be prepared, and if the rate of change Rd of position in the image is equal to or greater than the threshold th31 , it may be determined that the change in position in the image is large, and if it is less than the threshold th32 , it may be determined that the change in position in the image is small, and if it is less than the threshold th31 and equal to or greater than the threshold th32 , it may be determined that the result is the same as the determination result of this step at time t-1 (or, if this step has not been executed at time t-1, the most recent determination result of this step at a time prior to that).
なお、閾値th3(又は、閾値th31と閾値th32)は予め設定した固定値としてもよいが、過去の変化率Rdに応じた可変値としてもよい。例えば、時刻t-ΔTから時刻tまでの各時刻における画像中位置の変化率Rdの平均値μ3と分散σ3を算出した上で、th31=μ3+σ3,th32=μ3-σ3としてもよい。ただし、th31が低くなり過ぎることを防止するため、例えば、予め決めたチューニング値をRd'(例えば、Rd'=200%等)として、th31=max(μ3+σ3,Rd')としてもよい。 The threshold th 3 (or the thresholds th 31 and th 32 ) may be a preset fixed value, or may be a variable value according to the past rate of change Rd. For example, after calculating the average value μ 3 and variance σ 3 of the rate of change Rd of the position in the image at each time from time t-ΔT to time t, th 31 = μ 3 + σ 3 , th 32 = μ 3 - σ 3 may be set. However, in order to prevent th 31 from becoming too low, for example, a predetermined tuning value Rd' (for example, Rd' = 200%) may be set, and th 31 = max (μ 3 + σ 3 , Rd').
次に、認識状態パターン判定部203は、図3に示す認識状態パターン情報を参照して、現在の認識状態パターンが、認識状態パターン1~認識状態パターン5のいずれであるかを判定する(ステップS206)。すなわち、認識状態パターン判定部203は、物体種類の変化が大きく、かつ、画像中位置の変化も大きい場合は「認識状態パターン2」、物体種類の変化が大きく、かつ、画像中位置の変化は小さい場合は「認識状態パターン3」、物体種類の変化は小さく、かつ、画像中位置の変化が大きい場合は「認識状態パターン4」、物体種類の変化が小さく、かつ、画像中位置の変化も小さい場合は「認識状態パターン5」と判定する。
Next, the recognition state
次に、モデル選択部204は、図4に示すモデル種類情報を参照して、上記のステップS206で判定した認識状態パターンに対応するモデルを選択モデルとして選択する(ステップS207)。すなわち、モデル選択部204は、上記のステップS206で「認識状態パターン2」と判定された場合はモデルB、「認識状態パターン3」と判定された場合はモデルC、「認識状態パターン4」と判定された場合はモデルD、「認識状態パターン5」と判定された場合はモデルEを選択モデルとして選択する。
Next, the
そして、上記のステップS203又はステップS207に続いて、モデル選択部204は、選択モデルのモデルデータを記憶部205から読み込む(ステップS208)。これにより、次の時刻t+1における推論処理では、当該選択モデルが用いられることになる。
Then, following step S203 or step S207, the
<まとめ>
以上のように、本実施形態に係る動的モデル切替推論装置10は、画像認識タスクを対象として、現在の選択モデルにより推論処理を行った結果及びその変化のパターンを表す認識状態パターンに応じて、当該パターンに対応するモデルに選択モデルを動的に切り替えることができる。これにより、例えば、認識率が低い場合はより認識率が高い汎用モデルを選択モデルとしたり、或る特徴の変化が大きい場合はその特徴の認識に特化した軽量モデルを選択モデルとしたりすることができる。このため、特に、或る一定以上の認識率が得られている状況下では、特定の特徴の認識に特化した軽量モデルにより推論処理を行うことができるため、常に汎用モデルにより推論処理を行う場合と比べて、ハードウェアリソースの使用量を削減させることが可能となる。
<Summary>
As described above, the dynamic model
なお、本実施形態では画像認識タスクを対象としたが、これは一例であって、データを入力としてモデルにより推論処理を繰り返し実行する様々なタスクに対して適用可能である。例えば、データ分類、回帰、予測、異常検知等といった様々なタスクに対して適用可能である。 Note that while this embodiment focuses on image recognition tasks, this is merely one example, and the invention can be applied to a variety of tasks in which data is input and inference processing is repeatedly performed using a model. For example, the invention can be applied to a variety of tasks, such as data classification, regression, prediction, and anomaly detection.
本発明は、具体的に開示された上記の実施形態に限定されるものではなく、特許請求の範囲の記載から逸脱することなく、種々の変形や変更、既知の技術との組み合わせ等が可能である。 The present invention is not limited to the specifically disclosed embodiments above, and various modifications, changes, and combinations with known technologies are possible without departing from the scope of the claims.
10 動的モデル切替推論装置
101 入力装置
102 表示装置
103 外部I/F
103a 記録媒体
104 通信I/F
105 プロセッサ
106 メモリ装置
107 バス
201 推論部
202 状態変数取得部
203 認識状態パターン判定部
204 モデル選択部
205 記憶部
10 Dynamic model switching
103a Recording medium 104 Communication I/F
105
Claims (7)
複数のモデルの中から選択されたモデルを示す選択モデルにより、前記データに対して前記タスクの推論を実行する推論部と、
前記推論の結果に基づいて、次の繰り返しにおける推論を実行する選択モデルを前記複数のモデルの中から選択する選択部と、
を有し、
前記推論の結果には、前記データの1以上の特徴の各々に対する認識結果と、前記認識結果の確からしさを表す認識率とが含まれ、
前記選択部は、
現在の繰り返しにおける推論の結果に含まれる前記認識結果及び前記認識率のパターンに応じて、前記パターンに対応するモデルを、前記次の繰り返しにおける推論を実行する選択モデルとして選択する、推論装置。 An inference device that repeatedly executes inference of a predetermined task for each of a plurality of data,
an inference unit that executes inference of the task on the data using a selection model that indicates a model selected from a plurality of models;
a selection unit that selects a selection model for performing inference in a next iteration from among the plurality of models based on a result of the inference;
having
the result of the inference includes a recognition result for each of one or more features of the data, and a recognition rate representing the likelihood of the recognition result;
The selection unit is
An inference device that, depending on a pattern of the recognition result and the recognition rate included in a result of inference in a current iteration, selects a model corresponding to the pattern as a selected model for performing inference in the next iteration .
前記認識率が所定の閾値未満である場合、前記パターンに対応するモデルとして、前記1以上の特徴を認識可能な汎用モデルを前記選択モデルとして選択する、請求項1に記載の推論装置。 The selection unit is
The inference device according to claim 1 , wherein if the recognition rate is less than a predetermined threshold, a general-purpose model capable of recognizing the one or more features is selected as the selected model as a model corresponding to the pattern .
前記認識率が前記閾値以上である場合、前記パターンに対応するモデルとして、特定の特徴を認識可能な軽量モデルを前記選択モデルとして選択する、請求項1に記載の推論装置。 The selection unit is
The inference device according to claim 1 , wherein if the recognition rate is equal to or greater than the threshold, a lightweight model capable of recognizing a specific feature is selected as the selected model as a model corresponding to the pattern .
前記1以上の特徴には、前記データが表す画像中の物体の種類と、前記画像中における前記物体の位置との少なくとも一方が含まれ、
前記パターンは、前記認識率が前記閾値以上であるか否かと、現在の繰り返しにおける推論の結果に含まれる前記物体の種類と1つ前の繰り返しにおける推論の結果に含まれる前記物体の種類との変化有無と、現在の繰り返しにおける推論の結果に含まれる前記物体の位置と1つ前の繰り返しにおける推論の結果に含まれる前記物体の位置との変化量の大きさと、の組み合わせで表される、請求項4に記載の推論装置。 the task is an image recognition task,
the one or more features include at least one of a type of object in an image represented by the data and a position of the object in the image ;
5. The inference device of claim 4, wherein the pattern is represented by a combination of whether or not the recognition rate is equal to or greater than the threshold, whether or not there is a change between the type of object included in the inference result in the current iteration and the type of object included in the inference result in the previous iteration, and the magnitude of change between the position of the object included in the inference result in the current iteration and the position of the object included in the inference result in the previous iteration .
複数のモデルの中から選択されたモデルを示す選択モデルにより、前記データに対して前記タスクの推論を実行する推論手順と、
前記推論の結果に基づいて、次の繰り返しにおける推論を実行する選択モデルを前記複数のモデルの中から選択する選択手順と、
をコンピュータが実行し、
前記推論の結果には、前記データの1以上の特徴の各々に対する認識結果と、前記認識結果の確からしさを表す認識率とが含まれ、
前記選択手順は、
現在の繰り返しにおける推論の結果に含まれる前記認識結果及び前記認識率のパターンに応じて、前記パターンに対応するモデルを、前記次の繰り返しにおける推論を実行する選択モデルとして選択する、推論方法。 An inference method for repeatedly executing inference of a predetermined task for each of a plurality of data, comprising:
an inference procedure for performing inference of the task on the data using a selection model indicating a model selected from a plurality of models;
a selection step of selecting, based on a result of the inference, from among the plurality of models, a selection model for performing inference in a next iteration;
The computer executes
the result of the inference includes a recognition result for each of one or more features of the data, and a recognition rate representing the likelihood of the recognition result;
The selection step comprises:
An inference method comprising: selecting, depending on a pattern of the recognition result and the recognition rate contained in a result of inference in a current iteration, a model corresponding to the pattern as a selected model for performing inference in the next iteration .
複数のモデルの中から選択されたモデルを示す選択モデルにより、前記データに対して前記タスクの推論を実行する推論手順と、
前記推論の結果に基づいて、次の繰り返しにおける推論を実行する選択モデルを前記複数のモデルの中から選択する選択手順と、
をコンピュータに実行させ、
前記推論の結果には、前記データの1以上の特徴の各々に対する認識結果と、前記認識結果の確からしさを表す認識率とが含まれ、
前記選択手順は、
現在の繰り返しにおける推論の結果に含まれる前記認識結果及び前記認識率のパターンに応じて、前記パターンに対応するモデルを、前記次の繰り返しにおける推論を実行する選択モデルとして選択する、プログラム。 A program for repeatedly executing inference of a predetermined task for each of a plurality of data,
an inference procedure for performing inference of the task on the data using a selection model indicating a model selected from a plurality of models;
a selection step of selecting, based on a result of the inference, from among the plurality of models, a selection model for performing inference in a next iteration;
on the computer ,
the result of the inference includes a recognition result for each of one or more features of the data, and a recognition rate representing the likelihood of the recognition result;
The selection step comprises:
a program for selecting, depending on a pattern of the recognition result and the recognition rate included in a result of inference in a current iteration, a model corresponding to the pattern as a selection model for performing inference in the next iteration .
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2021074174A JP7700501B2 (en) | 2021-04-26 | 2021-04-26 | Inference device, inference method, and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2021074174A JP7700501B2 (en) | 2021-04-26 | 2021-04-26 | Inference device, inference method, and program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2022168599A JP2022168599A (en) | 2022-11-08 |
| JP7700501B2 true JP7700501B2 (en) | 2025-07-01 |
Family
ID=83933509
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2021074174A Active JP7700501B2 (en) | 2021-04-26 | 2021-04-26 | Inference device, inference method, and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP7700501B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120112530A (en) | 2022-10-20 | 2025-06-06 | 住友化学株式会社 | Crystals of 2-(5-cyclopropyl-3-(ethylsulfonyl)pyridin-2-yl)-5-((trifluoromethyl)sulfonyl)benzo[d]oxazole |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2020071665A (en) | 2018-10-31 | 2020-05-07 | 富士通株式会社 | Action recognition method, action recognition program, and action recognition device |
| JP2020160814A (en) | 2019-03-27 | 2020-10-01 | 沖電気工業株式会社 | Recognition device, recognition method and program |
| JP2021018593A (en) | 2019-07-19 | 2021-02-15 | 株式会社日立製作所 | Information processing device for vehicle |
-
2021
- 2021-04-26 JP JP2021074174A patent/JP7700501B2/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2020071665A (en) | 2018-10-31 | 2020-05-07 | 富士通株式会社 | Action recognition method, action recognition program, and action recognition device |
| JP2020160814A (en) | 2019-03-27 | 2020-10-01 | 沖電気工業株式会社 | Recognition device, recognition method and program |
| JP2021018593A (en) | 2019-07-19 | 2021-02-15 | 株式会社日立製作所 | Information processing device for vehicle |
Also Published As
| Publication number | Publication date |
|---|---|
| JP2022168599A (en) | 2022-11-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11055571B2 (en) | Information processing device, recording medium recording information processing program, and information processing method | |
| US11562166B2 (en) | Generating shift-invariant neural network feature maps and outputs | |
| JP6393230B2 (en) | Object detection method and image search system | |
| US9208374B2 (en) | Information processing apparatus, control method therefor, and electronic device | |
| CN114139630B (en) | Gesture recognition method and device, storage medium and electronic equipment | |
| KR102413588B1 (en) | Object recognition model recommendation method, system and computer program according to training data | |
| CN109948735A (en) | A multi-label classification method, system, device and storage medium | |
| US9619729B2 (en) | Density measuring device, density measuring method, and computer program product | |
| CN118569340A (en) | Deep Neural Network Model Compression | |
| JP2018195231A (en) | Learning model creation device, learning model creation method, and learning model creation program | |
| JP2019185121A (en) | Learning device, learning method and program | |
| CN111429481B (en) | A target tracking method, device and terminal based on adaptive expression | |
| US9652722B1 (en) | Methods and systems for robust supervised machine learning | |
| CN110796250A (en) | Convolution processing method, system and related components applied to convolutional neural network | |
| JP7700501B2 (en) | Inference device, inference method, and program | |
| JP6930195B2 (en) | Model identification device, prediction device, monitoring system, model identification method and prediction method | |
| KR20220016402A (en) | Apparatus and method for parallel deep neural networks trained by resized images with multiple scaling factors | |
| US20250239056A1 (en) | Information processing apparatus, information processing method, and storage medium | |
| KR102813612B1 (en) | Pruning method for designing a neural network structure and computing device therefor | |
| CN114764594B (en) | Classification model feature selection method, device and equipment | |
| JP2018088080A (en) | Learning device and learning method | |
| CN114386414B (en) | A method, device, electronic device and storage medium for extracting named entities | |
| CN113362372B (en) | Single target tracking method and computer readable medium | |
| CN117474070A (en) | Model pruning method, face recognition model training method and face recognition method | |
| JP2023075612A (en) | Machine learning program, machine learning method and information processing device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20240313 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20250128 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20250310 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20250520 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20250602 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 7700501 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |