差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン | 次のリビジョン両方とも次のリビジョン | ||
opencv_dnn:環境構築:dnn_with_cuda [2020/02/12 18:04] – baba | opencv_dnn:環境構築:dnn_with_cuda [2020/02/13 17:26] – [object_detection.cppの修正] baba | ||
---|---|---|---|
行 367: | 行 367: | ||
std:: | std:: | ||
std:: | std:: | ||
- | if (outLayerType == " | + | boxes.clear(); |
+ | | ||
+ | { | ||
+ | /* | ||
+ | // Network produces output blob with a shape 1x1xNx7 where N is a number of | ||
+ | // detections and an every detection is a vector of values | ||
+ | // [batchId, classId, confidence, left, top, right, bottom] | ||
+ | CV_Assert(outs.size() == 1); | ||
+ | float* data = (float*)outs[0].data; | ||
+ | for (size_t i = 0; i < outs[0].total(); | ||
+ | { | ||
+ | float confidence = data[i + 2]; | ||
+ | if (confidence > confidenceThreshold) | ||
+ | { | ||
+ | int left = (int)data[i + 3]; | ||
+ | int top = (int)data[i + 4]; | ||
+ | int right = (int)data[i + 5]; | ||
+ | int bottom = (int)data[i + 6]; | ||
+ | int width = right - left + 1; | ||
+ | int height = bottom - top + 1; | ||
+ | classIds.push_back((int)(data[i + 1]) - 1); // Skip 0th background class id. | ||
+ | // boxes.push_back(Rect(left, | ||
+ | confidences.push_back(confidence); | ||
+ | } | ||
+ | } | ||
+ | */ | ||
+ | } | ||
+ | else if (outLayerType == " | ||
{ | { | ||
// Network produces output blob with a shape 1x1xNx7 where N is a number of | // Network produces output blob with a shape 1x1xNx7 where N is a number of | ||
行 435: | 行 462: | ||
else | else | ||
CV_Error(Error:: | CV_Error(Error:: | ||
+ | |||
std:: | std:: | ||
行 445: | 行 473: | ||
box.x + box.width, box.y + box.height, frame); | box.x + box.width, box.y + box.height, frame); | ||
} | } | ||
+ | |||
+ | |||
} | } | ||