@@ -181,14 +181,15 @@ void ModelYolo::prepareInputsOutputs(std::shared_ptr<ov::Model>& model) {
181181
182182 for (const auto & name : outputsNames) {
183183 const auto & shape = outShapes[name];
184- int classes = (int )shape[ov::layout::channels_idx (yoloRegionLayout)] / num - 4 - (isObjConf ? 1 : 0 );
185184 if (shape[ov::layout::channels_idx (yoloRegionLayout)] % num != 0 ) {
186185 throw std::logic_error (std::string (" Output tenosor " ) + name + " has wrong 2nd dimension" );
187186 }
188- regions.emplace (name, Region (classes, 4 ,
187+ regions.emplace (name, Region (
188+ shape[ov::layout::channels_idx (yoloRegionLayout)] / num - 4 - (isObjConf ? 1 : 0 ),
189+ 4 ,
189190 presetAnchors.size () ? presetAnchors : defaultAnchors[yoloVersion],
190191 std::vector<int64_t >(chosenMasks.begin () + i * num, chosenMasks.begin () + (i + 1 ) * num),
191- ( int ) shape[ov::layout::width_idx (yoloRegionLayout)], ( int ) shape[ov::layout::height_idx (yoloRegionLayout)]));
192+ shape[ov::layout::width_idx (yoloRegionLayout)], shape[ov::layout::height_idx (yoloRegionLayout)]));
192193 i++;
193194 }
194195 }
@@ -315,7 +316,7 @@ void ModelYolo::parseYOLOOutput(const std::string& output_name,
315316 obj.width = clamp (width, 0 .f , (float )original_im_w - obj.x );
316317 obj.height = clamp (height, 0 .f , (float )original_im_h - obj.y );
317318
318- for (int j = 0 ; j < region.classes ; ++j) {
319+ for (size_t j = 0 ; j < region.classes ; ++j) {
319320 int class_index = calculateEntryIndex (entriesNum, region.coords , region.classes + isObjConf, n * entriesNum + i, region.coords + isObjConf + j);
320321 float prob = scale * postprocessRawData (outData[class_index]);
321322
@@ -332,7 +333,7 @@ void ModelYolo::parseYOLOOutput(const std::string& output_name,
332333 }
333334}
334335
335- int ModelYolo::calculateEntryIndex (int totalCells, int lcoords, int lclasses, int location, int entry) {
336+ int ModelYolo::calculateEntryIndex (int totalCells, int lcoords, size_t lclasses, int location, int entry) {
336337 int n = location / totalCells;
337338 int loc = location % totalCells;
338339 return (n * (lcoords + lclasses) + entry) * totalCells + loc;
@@ -353,8 +354,8 @@ ModelYolo::Region::Region(const std::shared_ptr<ov::op::v0::RegionYolo>& regionY
353354 num = mask.size ();
354355
355356 auto shape = regionYolo->get_input_shape (0 );
356- outputWidth = ( int ) shape[3 ];
357- outputHeight = ( int ) shape[2 ];
357+ outputWidth = shape[3 ];
358+ outputHeight = shape[2 ];
358359
359360 if (num) {
360361
@@ -377,7 +378,7 @@ ModelYolo::Region::Region(const std::shared_ptr<ov::op::v0::RegionYolo>& regionY
377378 }
378379}
379380
380- ModelYolo::Region::Region (int classes, int coords, const std::vector<float >& anchors, const std::vector<int64_t >& masks, int outputWidth, int outputHeight) :
381+ ModelYolo::Region::Region (size_t classes, int coords, const std::vector<float >& anchors, const std::vector<int64_t >& masks, size_t outputWidth, size_t outputHeight) :
381382 classes(classes), coords(coords),
382383 outputWidth(outputWidth), outputHeight(outputHeight) {
383384 num = masks.size ();
0 commit comments