diff --git a/openbr/plugins/meta.cpp b/openbr/plugins/meta.cpp index b4cc865..5905c31 100644 --- a/openbr/plugins/meta.cpp +++ b/openbr/plugins/meta.cpp @@ -614,6 +614,11 @@ public: void train(const TemplateList &data) { + if (!transform->trainable) { + qWarning("Attempted to train untrainable transform, nothing will happen."); + return; + } + transform->train(data); } @@ -628,7 +633,6 @@ public: else dst = output[0]; } - // For each input template, form a single element TemplateList, push all those // lists through transform, and form dst by concatenating the results. // Process the single elemnt templates in parallel if parallelism is enabled. @@ -677,7 +681,6 @@ public: void init() { - if (transform && transform->timeVarying()) transform = new br::TimeInvariantWrapperTransform(transform); } diff --git a/openbr/plugins/openbr_internal.h b/openbr/plugins/openbr_internal.h index 27136da..ffe5cbf 100644 --- a/openbr/plugins/openbr_internal.h +++ b/openbr/plugins/openbr_internal.h @@ -122,7 +122,10 @@ public: TimeInvariantWrapperTransform(Transform * basis) : transformSource(new TransformCopier(basis)) { + if (!basis) + qFatal("TimeInvariantWrapper created with NULL transform"); baseTransform = basis; + trainable = basis->trainable; } virtual void project(const Template &src, Template &dst) const @@ -132,7 +135,6 @@ public: transformSource.release(aTransform); } - void project(const TemplateList &src, TemplateList &dst) const { Transform * aTransform = transformSource.acquire(); diff --git a/openbr/plugins/stream.cpp b/openbr/plugins/stream.cpp index 3754609..45c7a37 100644 --- a/openbr/plugins/stream.cpp +++ b/openbr/plugins/stream.cpp @@ -1025,7 +1025,7 @@ public: void train(const TemplateList & data) { if (!trainable) { - qWarning("How did this happen? You're training a nontrainable transform."); + qWarning("Attempted to train untrainable transform, nothing will happen."); return; } qFatal("Stream train is currently not implemented.");