@@ -152,6 +152,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
152
152
153
153
class CV_EXPORTS ActivationLayer;
154
154
class CV_EXPORTS BatchNormLayer;
155
+ class CV_EXPORTS ScaleLayer;
155
156
156
157
/* * @brief This interface class allows to build new Layers - are building blocks of networks.
157
158
*
@@ -269,6 +270,19 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
269
270
*/
270
271
virtual bool setBatchNorm (const Ptr<BatchNormLayer>& layer);
271
272
273
+ /* *
274
+ * @brief Tries to attach to the layer the subsequent scaling layer, i.e. do the layer fusion in a partial case.
275
+ * @param[in] layer The subsequent scaling layer.
276
+ *
277
+ * Returns true if the scaling layer has been attached successfully.
278
+ */
279
+ virtual bool setScale (const Ptr<ScaleLayer>& layer);
280
+
281
+ /* *
282
+ * @brief "Deattaches" all the layers, attached to particular layer.
283
+ */
284
+ virtual void unsetAttached ();
285
+
272
286
virtual bool getMemoryShapes (const std::vector<MatShape> &inputs,
273
287
const int requiredOutputs,
274
288
std::vector<MatShape> &outputs,
@@ -495,9 +509,10 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
495
509
496
510
/* * @overload */
497
511
CV_WRAP void getLayerShapes (const std::vector<MatShape>& netInputShapes,
498
- const int layerId,
499
- std::vector<MatShape>* inLayerShapes,
500
- std::vector<MatShape>* outLayerShapes) const ;
512
+ const int layerId,
513
+ std::vector<MatShape>* inLayerShapes,
514
+ std::vector<MatShape>* outLayerShapes) const ;
515
+
501
516
/* * @brief Computes FLOP for whole loaded model with specified input shapes.
502
517
* @param netInputShapes vector of shapes for all net inputs.
503
518
* @returns computed FLOP.
@@ -507,10 +522,10 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
507
522
CV_WRAP int64 getFLOPS (const MatShape& netInputShape) const ;
508
523
/* * @overload */
509
524
CV_WRAP int64 getFLOPS (const int layerId,
510
- const std::vector<MatShape>& netInputShapes) const ;
525
+ const std::vector<MatShape>& netInputShapes) const ;
511
526
/* * @overload */
512
527
CV_WRAP int64 getFLOPS (const int layerId,
513
- const MatShape& netInputShape) const ;
528
+ const MatShape& netInputShape) const ;
514
529
515
530
/* * @brief Returns list of types for layer used in model.
516
531
* @param layersTypes output parameter for returning types.
@@ -557,8 +572,13 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN
557
572
CV_WRAP void getMemoryConsumption (const MatShape& netInputShape,
558
573
CV_OUT std::vector<int >& layerIds, CV_OUT std::vector<size_t >& weights,
559
574
CV_OUT std::vector<size_t >& blobs) const ;
560
- private:
561
575
576
+ /* * @brief Enables or disables layer fusion in the network.
577
+ * @param fusion true to enable the fusion, false to disable. The fusion is enabled by default.
578
+ */
579
+ CV_WRAP void enableFusion (bool fusion);
580
+
581
+ private:
562
582
struct Impl ;
563
583
Ptr<Impl> impl;
564
584
};
0 commit comments