private static void PredictGPU(ProcessorState state)
{
DateTime ExecutionStartTime;
DateTime ExecutionStopTime;
TimeSpan ExecutionTime;
ExecutionStartTime = DateTime.Now;
state.feature.PredictGPU(state.depth, ref state.predict_output_);
ExecutionStopTime = DateTime.Now;
ExecutionTime = ExecutionStopTime - ExecutionStartTime;
Console.WriteLine("Use {0} ms for getting GPU prediction", ExecutionTime.TotalMilliseconds.ToString());
//ExecutionStartTime = DateTime.Now;
//ShowAverageAndVariance(state.predict_output_, state);
/*
ExecutionStopTime = DateTime.Now;
ExecutionTime = ExecutionStopTime - ExecutionStartTime;
Console.WriteLine("Use {0} ms for getting Average and Variance", ExecutionTime.TotalMilliseconds.ToString());
*/
for (int y = state.crop.Value.Y; y <= state.crop.Value.Y + state.crop.Value.Height; y++)
{
for (int x = state.crop.Value.X; x <= state.crop.Value.X + state.crop.Value.Width; x++)
{
int depth_index = Util.toID(x, y, width, height, kDepthStride);
int predict_label = 0;
int y_index = depth_index * state.feature.num_classes_;
for (int i = 1; i < state.feature.num_classes_; i++)
if (state.predict_output_[y_index + i] > state.predict_output_[y_index + predict_label])
predict_label = i;
state.predict_labels_[depth_index] = predict_label;
}
}
}