有人可以帮助我理解TF lite函数ApplyFilter()代码吗?

时间:2019-06-23 17:21:38

标签: java android tensorflow tensorflow-lite

有人可以帮助我理解此代码吗?它是TENSORFLOW LITE DEMO APP中用于分类目的的功能。

void applyFilter(){
int num_labels =  labelList.size();

// Low pass filter `labelProbArray` into the first stage of the filter.
for(int j=0; j<num_labels; ++j){
  filterLabelProbArray[0][j] += FILTER_FACTOR*(labelProbArray[0][j] -
                                               filterLabelProbArray[0][j]);
}
// Low pass filter each stage into the next.
for (int i=1; i<FILTER_STAGES; ++i){
  for(int j=0; j<num_labels; ++j){
    filterLabelProbArray[i][j] += FILTER_FACTOR*(
            filterLabelProbArray[i-1][j] -
            filterLabelProbArray[i][j]);

  }
}

// Copy the last stage filter output back to `labelProbArray`.
for(int j=0; j<num_labels; ++j){
  labelProbArray[0][j] = filterLabelProbArray[FILTER_STAGES-1][j];
}}

0 个答案:

没有答案