From 6c2dfae015f6d3143bddd53a8d5ae36997fb5d1d Mon Sep 17 00:00:00 2001 From: hyunil park Date: Thu, 2 Mar 2023 15:11:24 +0900 Subject: [PATCH] [API][trainer] Rename some variable to use nouns instead of verbs - Rename 'train' and 'valid' to 'training' and 'validation' Signed-off-by: hyunil park --- gst/nnstreamer/elements/gsttensor_trainer.c | 21 +++++++++++---------- gst/nnstreamer/elements/gsttensor_trainer.h | 2 +- .../include/nnstreamer_plugin_api_trainer.h | 10 +++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gst/nnstreamer/elements/gsttensor_trainer.c b/gst/nnstreamer/elements/gsttensor_trainer.c index aebe6be..d9fef66 100644 --- a/gst/nnstreamer/elements/gsttensor_trainer.c +++ b/gst/nnstreamer/elements/gsttensor_trainer.c @@ -265,9 +265,9 @@ gst_tensor_trainer_init (GstTensorTrainer * trainer) trainer->inputtype_configured = FALSE; trainer->total_invoke_num = 0; - g_cond_init (&trainer->train_complete_cond); + g_cond_init (&trainer->training_complete_cond); g_mutex_init (&trainer->trainer_lock); - trainer->prop.train_complete_cond = &trainer->train_complete_cond; + trainer->prop.training_complete_cond = &trainer->training_complete_cond; gst_tensor_trainer_output_dimension (trainer); gst_tensor_trainer_output_type (trainer); @@ -291,7 +291,7 @@ gst_tensor_trainer_finalize (GObject * object) g_free (trainer->input_type); g_free (trainer->output_type); - g_cond_clear (&trainer->train_complete_cond); + g_cond_clear (&trainer->training_complete_cond); g_mutex_clear (&trainer->trainer_lock); if (trainer->fw_created && trainer->fw) { @@ -335,10 +335,10 @@ gst_tensor_trainer_set_property (GObject * object, guint prop_id, trainer->prop.num_labels = g_value_get_uint (value); break; case PROP_NUM_TRAINING_SAMPLES: - trainer->prop.num_train_samples = g_value_get_uint (value); + trainer->prop.num_training_samples = g_value_get_uint (value); break; case PROP_NUM_VALIDATION_SAMPLES: - trainer->prop.num_valid_samples = g_value_get_uint (value); + trainer->prop.num_validation_samples = g_value_get_uint (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -380,10 +380,10 @@ gst_tensor_trainer_get_property (GObject * object, guint prop_id, g_value_set_uint (value, trainer->prop.num_labels); break; case PROP_NUM_TRAINING_SAMPLES: - g_value_set_uint (value, trainer->prop.num_train_samples); + g_value_set_uint (value, trainer->prop.num_training_samples); break; case PROP_NUM_VALIDATION_SAMPLES: - g_value_set_uint (value, trainer->prop.num_valid_samples); + g_value_set_uint (value, trainer->prop.num_validation_samples); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -540,7 +540,8 @@ gst_tensor_trainer_chain (GstPad * sinkpad, GstObject * parent, */ if (trainer->total_invoke_num == 1 || trainer->total_invoke_num == - trainer->prop.num_train_samples + trainer->prop.num_valid_samples) { + trainer->prop.num_training_samples + + trainer->prop.num_validation_samples) { /* Prepare output tensor */ for (i = 0; i < trainer->output_meta.num_tensors; i++) { @@ -712,8 +713,8 @@ gst_tensor_trainer_sink_event (GstPad * sinkpad, GstObject * parent, GST_INFO_OBJECT (trainer, "get GST_EVENT_EOS event..state is %d", GST_STATE (trainer)); g_mutex_lock (&trainer->trainer_lock); - GST_INFO_OBJECT (trainer, "wait for train_complete_cond signal"); - g_cond_wait (&trainer->train_complete_cond, &trainer->trainer_lock); + GST_INFO_OBJECT (trainer, "wait for training_complete_cond signal"); + g_cond_wait (&trainer->training_complete_cond, &trainer->trainer_lock); g_mutex_unlock (&trainer->trainer_lock); break; case GST_EVENT_FLUSH_START: diff --git a/gst/nnstreamer/elements/gsttensor_trainer.h b/gst/nnstreamer/elements/gsttensor_trainer.h index beb87a9..27cf42e 100644 --- a/gst/nnstreamer/elements/gsttensor_trainer.h +++ b/gst/nnstreamer/elements/gsttensor_trainer.h @@ -71,7 +71,7 @@ struct _GstTensorTrainer GstTensorTrainerProperties prop; /**< NNFW plugin's properties */ GMutex trainer_lock; - GCond train_complete_cond; + GCond training_complete_cond; }; /** diff --git a/gst/nnstreamer/include/nnstreamer_plugin_api_trainer.h b/gst/nnstreamer/include/nnstreamer_plugin_api_trainer.h index d3fee87..bd0d2a6 100644 --- a/gst/nnstreamer/include/nnstreamer_plugin_api_trainer.h +++ b/gst/nnstreamer/include/nnstreamer_plugin_api_trainer.h @@ -35,11 +35,11 @@ typedef struct _GstTensorTrainerProperties const char *model_save_path; /**< The file path to save the model */ int64_t num_inputs; /**< The number of input lists, the input is where framework receive the features to train the model, num_inputs indicates how many inputs there are. */ int64_t num_labels; /**< The number of label lists, the label is where framework receive the class to train the model, num_labels indicates how many labels there are. */ - int64_t num_train_samples; /**< The number of train sample used to train the model. */ - int64_t num_valid_samples; /**< The number of valid sample used to train the model. */ - int64_t num_epochs; /**< The number of repetition of total train and valid sample. subplugin must receive total samples((num_train_samples + num_valid_samples) * num_epochs) */ + int64_t num_training_samples; /**< The number of training sample used to train the model. */ + int64_t num_validation_samples; /**< The number of validation sample used to valid the model. */ + int64_t num_epochs; /**< The number of repetition of total training and validation sample. subplugin must receive total samples((num_training_samples + num_validation_samples) * num_epochs) */ - GCond *train_complete_cond; /**< Tensor trainer wait when receive EOS before model training is complete, subplugin should send signal when model train is complete. */ + GCond *training_complete_cond; /**< Tensor trainer wait when receive EOS before model training is complete, subplugin should send signal when model training is complete. */ } GstTensorTrainerProperties; /** @@ -50,7 +50,7 @@ typedef struct _GstTensorTrainerProperties typedef struct _GstTensorTrainerFrameworkInfo { const char *name; /**< Name of the neural network framework, searchable by FRAMEWORK property. */ - int train_complete; /**< Check if train is complete, Use int instead of gboolean because this is refered by custom plugins. */ + int is_training_complete; /**< Check if training is complete, Use int instead of gboolean because this is refered by custom plugins. */ int64_t epoch_cnt; /**< Number of currently completed epochs */ } GstTensorTrainerFrameworkInfo; -- 2.7.4