def unet_run_model(self,
                       model,
                       X_in_test,
                       model_path,
                       logs_path,
                       plots_path,
                       test_result=0,
                       Y_out_test=0,
                       y_cop_test=0,
                       activate_tensorboard=0,
                       run_id=0,
                       tl_type='full_fine_tune'):
        """run_train_model function trains the model on the dataset and saves the trained model,logs and plots within the file structure, the function prints the training evaluation metrics
			
			:param model: 3D CNN model compiled within the Deep Learning Class, refer https://keras.io/models/model/ for more information 
			:type model: keras.models (required)

			:param X_in: Train dataset input (predictor variables), 3D Voxel representation of the cloud of point and node deviation data obtained from the VRM software based on the sampling input
			:type X_in: numpy.array [samples*voxel_dim*voxel_dim*voxel_dim*deviation_channels] (required)
			
			:param Y_out: Train dataset output (variables to predict), Process Parameters/KCCs obtained from sampling
			:type Y_out: numpy.array [samples*assembly_kccs] (required)

			:param model_path: model path at which the trained model is saved
			:type model_path: str (required)
			
			:param logs_path: logs path where the training metrics file is saved
			:type logs_path: str (required)

			:param plots_path: plots path where model training loss convergence plot is saved
			:type plots_path: str (required)

			:param activate_tensorboard: flag to indicate if tensorboard should be added in model callbacks for better visualization, 0 by default, set to 1 to activate tensorboard
			:type activate_tensorboard: int

			:param run_id: Run id index used in data study to conduct multiple training runs with different dataset sizes, defaults to 0
			:type run_id: int			
		"""
        import tensorflow as tf
        from tensorflow.keras.models import load_model
        import tensorflow.keras.backend as K
        #model_file_path=model_path+'/unet_trained_model_'+str(run_id)+'.h5'
        model_file_path = model_path + '/unet_trained_model_' + str(run_id)

        #tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir='C:\\Users\\sinha_s\\Desktop\\dlmfg_package\\dlmfg\\trained_models\\inner_rf_assembly\\logs',histogram_freq=1)

        #inference_model=load_model(model_file_path,custom_objects={'mse_scaled': mse_scaled} )
        model.load_weights(model_file_path)
        print("Trained Model Weights loaded successfully")
        print("Conducting Inference...")
        y_pred, y_cop_pred = model.predict(X_in_test)
        print("Inference Completed !")

        if (test_result == 1):
            metrics_eval = MetricsEval()
            eval_metrics, accuracy_metrics_df = metrics_eval.metrics_eval_base(
                y_pred, Y_out_test, logs_path)

            #y_cop_pred_flat=y_cop_pred.flatten()
            #y_cop_test_flat=y_cop_test.flatten()

            #combined_array=np.stack([y_cop_test_flat,y_cop_pred_flat],axis=1)
            #filtered_array=combined_array[np.where(combined_array[:,0] >= 0.05)]
            #y_cop_test_vector=filtered_array[:,0:1]
            #y_cop_pred_vector=filtered_array[:,1:2]

            y_cop_pred_vector = np.reshape(y_cop_pred,
                                           (y_cop_pred.shape[0], -1))
            y_cop_test_vector = np.reshape(y_cop_test,
                                           (y_cop_test.shape[0], -1))
            y_cop_pred_vector = y_cop_pred_vector.T
            y_cop_test_vector = y_cop_test_vector.T
            print(y_cop_pred_vector.shape)
            #y_cop_test_flat=y_cop_test.flatten()

            eval_metrics_cop, accuracy_metrics_df_cop = metrics_eval.metrics_eval_cop(
                y_cop_pred_vector, y_cop_test_vector, logs_path)

            return y_pred, y_cop_pred, model, eval_metrics, accuracy_metrics_df, eval_metrics_cop, accuracy_metrics_df_cop

        return y_pred, y_cop_pred, model
    index = 0

    for i in range(output_heads):
        y_cop_pred = model_outputs[2][:, :, :, :, t:t + 3]
        y_cop_test = Y_out_test_list[2][:, :, :, :, t:t + 3]
        y_cop_actual = y_cop_test

        y_cop_pred_vector = np.reshape(y_cop_pred, (y_cop_pred.shape[0], -1))
        y_cop_test_vector = np.reshape(y_cop_test, (y_cop_test.shape[0], -1))
        y_cop_pred_vector = y_cop_pred_vector.T
        y_cop_test_vector = y_cop_test_vector.T

        print(y_cop_pred_vector.shape)
        #y_cop_test_flat=y_cop_test.flatten()

        eval_metrics_cop, accuracy_metrics_df_cop = metrics_eval.metrics_eval_cop(
            y_cop_pred_vector, y_cop_test_vector, logs_path)

        eval_metrics_cop_list.append(eval_metrics_cop)
        accuracy_metrics_df_cop_list.append(accuracy_metrics_df_cop)

        accuracy_metrics_df_cop.to_csv(logs_path + '/metrics_test_cop_' +
                                       str(index) + '.csv')

        print("The Model Segmentation Validation Metrics are ")
        print(accuracy_metrics_df_cop.mean())

        accuracy_metrics_df_cop.mean().to_csv(logs_path +
                                              '/metrics_test_cop_summary_' +
                                              str(index) + '.csv')

        #Saving For Matlab Plotting