@@ -40,7 +40,7 @@ cv::Size BaseInstanceSegmentation::modelInputSize() const {
4040 return VisionModel::modelInputSize ();
4141 }
4242 const auto &shape = inputShapes[0 ];
43- return cv::Size ( shape[shape.size () - 2 ], shape[shape.size () - 1 ]) ;
43+ return { shape[shape.size () - 2 ], shape[shape.size () - 1 ]} ;
4444}
4545
4646std::vector<types::Instance> BaseInstanceSegmentation::runInference (
@@ -149,7 +149,7 @@ cv::Rect BaseInstanceSegmentation::computeMaskCropRect(
149149 int32_t my2 =
150150 std::min (maskSize.height , static_cast <int32_t >(std::ceil (my2F)));
151151
152- return cv::Rect ( mx1, my1, mx2 - mx1, my2 - my1) ;
152+ return { mx1, my1, mx2 - mx1, my2 - my1} ;
153153}
154154
155155cv::Rect BaseInstanceSegmentation::addPaddingToRect (const cv::Rect &rect,
@@ -159,7 +159,7 @@ cv::Rect BaseInstanceSegmentation::addPaddingToRect(const cv::Rect &rect,
159159 int32_t x2 = std::min (maskSize.width , rect.x + rect.width + 1 );
160160 int32_t y2 = std::min (maskSize.height , rect.y + rect.height + 1 );
161161
162- return cv::Rect ( x1, y1, x2 - x1, y2 - y1) ;
162+ return { x1, y1, x2 - x1, y2 - y1} ;
163163}
164164
165165cv::Mat BaseInstanceSegmentation::warpToOriginalResolution (
@@ -253,6 +253,12 @@ void BaseInstanceSegmentation::ensureMethodLoaded(
253253 " or 'forward_{inputSize}' for multi-method models." );
254254 }
255255
256+ if (!module_) {
257+ throw RnExecutorchError (RnExecutorchErrorCode::ModuleNotLoaded,
258+ " Model not loaded: Cannot load method '" +
259+ methodName + " '" );
260+ }
261+
256262 if (currentlyLoadedMethod_ != methodName) {
257263 if (!currentlyLoadedMethod_.empty ()) {
258264 module_->unload_method (currentlyLoadedMethod_);
0 commit comments