mv_machine_learning: drop parsing dependency from image classification
authorVibhav Aggarwal <v.aggarwal@samsung.com>
Tue, 7 Nov 2023 10:01:57 +0000 (19:01 +0900)
committerInki Dae <inki.dae@samsung.com>
Tue, 14 Nov 2023 07:40:07 +0000 (16:40 +0900)
commit8b42d3eca68471739941284546c755731b6b4ac9
tree1d6537203a1dc0aa442497252ff92e6315cd5eff
parent1b62c3b6ea158257250886793b98e9f689a544d2
mv_machine_learning: drop parsing dependency from image classification

[Issue type] : code refactoring

Drop the configuration and meta file parsing dependency from ImageClassification
class.

Until now, the concrete class of each task group got the task group
configuration information from its own configuration file, and also
included a MetaParser class object to get the tensor information,
which is corresponding to a given model file.

However, these dependencies led code smell, divergent change[1] even though
the concrete class has no any dependency from parsing the configuration and
meta files - needed only information after parsed.

As a first refactoring work, this patch extracts parsing portion from
ImageClassification class and introduces as a new class, ImageClassificationConfig
class.

With this, adapter classes of the image classification task group will parse
the configuration and meta files before creating ImageClassification class.
And then it will create ImageClassification class with needed information.
As a result, we could manage the ImageClassification class without any
dependency on parsing work.

[1] https://refactoring.guru/smells/divergent-change

Change-Id: I421dcd6f796e6865dde3e5fed597ef83e7e5bc12
Signed-off-by: Vibhav Aggarwal <v.aggarwal@samsung.com>
mv_machine_learning/image_classification/include/image_classification.h
mv_machine_learning/image_classification/include/image_classification_adapter.h
mv_machine_learning/image_classification/include/image_classification_config.h [new file with mode: 0644]
mv_machine_learning/image_classification/include/image_classification_default.h
mv_machine_learning/image_classification/src/image_classification.cpp
mv_machine_learning/image_classification/src/image_classification_adapter.cpp
mv_machine_learning/image_classification/src/image_classification_config.cpp [new file with mode: 0644]
mv_machine_learning/image_classification/src/image_classification_default.cpp