@@ -41,15 +41,8 @@ namespace models {
4141 */
4242class VisionModel : public BaseModel {
4343public:
44- /* *
45- * @brief Construct a VisionModel with the same parameters as BaseModel
46- *
47- * VisionModel uses the same construction pattern as BaseModel, just adding
48- * thread-safety on top.
49- */
5044 VisionModel (const std::string &modelSource,
51- std::shared_ptr<react::CallInvoker> callInvoker)
52- : BaseModel(modelSource, callInvoker) {}
45+ std::shared_ptr<react::CallInvoker> callInvoker);
5346
5447 virtual ~VisionModel () = default ;
5548
@@ -62,12 +55,13 @@ class VisionModel : public BaseModel {
6255 * destroys module_ while generateFromFrame() is still executing on the
6356 * VisionCamera worklet thread.
6457 */
65- void unload () noexcept {
66- std::scoped_lock lock (inference_mutex_);
67- BaseModel::unload ();
68- }
58+ void unload () noexcept ;
6959
7060protected:
61+ // / Cached input tensor shape (getAllInputShapes()[0]).
62+ // / Set once by each subclass constructor to avoid per-frame metadata lookups.
63+ std::vector<int32_t > modelInputShape_;
64+
7165 /* *
7266 * @brief Mutex to ensure thread-safe inference
7367 *
@@ -96,18 +90,8 @@ class VisionModel : public BaseModel {
9690 */
9791 virtual cv::Mat preprocess (const cv::Mat &image) const ;
9892
99- // / Cached input tensor shape (getAllInputShapes()[0]).
100- // / Set once by each subclass constructor to avoid per-frame metadata lookups.
101- std::vector<int32_t > modelInputShape_;
102-
10393 // / Convenience accessor: spatial dimensions of the model input.
104- cv::Size modelInputSize () const {
105- if (modelInputShape_.size () < 2 ) {
106- return {0 , 0 };
107- }
108- return cv::Size (modelInputShape_[modelInputShape_.size () - 1 ],
109- modelInputShape_[modelInputShape_.size () - 2 ]);
110- }
94+ cv::Size modelInputSize () const ;
11195
11296 /* *
11397 * @brief Extract an RGB cv::Mat from a VisionCamera frame
0 commit comments