easy_vision.python.main¶
Binary to run train and evaluation on easy vision model.
-
easy_vision.python.main.
train_and_evaluate
(pipeline_config_path, continue_train=False)[source]¶ Build an CVEstimator, and then train and evaluate the estimator.
Parameters: - pipeline_config_path – a path to proto.CvEstimator object, specifies
- train_config – model_config, data_config and eval_config
- continue_train – whether to restart train from an existing checkpoint
Returns: None, the model will be saved into train_config.model_dir
-
easy_vision.python.main.
train_and_evaluate_with_param_config
(param_config_str, continue_train=False, data_prefix='')[source]¶ train and evaluate the model with parameters.
Parameters: - param_config_str – model parameters config string
- continue_train – whether to restart train from an existing checkpoint
- data_prefix – data path prefix for data and pretrained-models, e.g., osspath oss://pai-vision-data/, local path /home/user/data
Returns: None, the model will be saved into train_config.model_dir
-
easy_vision.python.main.
evaluate
(pipeline_config_path, eval_checkpoint_path='', eval_data_path=None, eval_result_filename='eval_result.txt')[source]¶ Evaluate for evaluation for eval data in pipeline_config_path, the metrics will also be displayed on tensorboard.
Parameters: - pipeline_config_path – config for the model, eval_data, eval_config
- eval_checkpoint_path – if specified, will use this model instead of model specified by model_dir in pipeline_config_path
- eval_data_path – eval data path, default use eval data in pipeline_config could be a path or a list of paths
Returns: - a dict of evaluation metrics, the metrics are specified in
pipeline_config_path
Raises: AssertionError
– if pipeline_config_path does not exist
-
easy_vision.python.main.
predict
(pipeline_config_path, test_checkpoint_path='', test_filelist=None)[source]¶ Test for evaluation for eval_data in pipeline_config_path
Parameters: - pipeline_config_path – file specify proto.CvEstimator, including model_config, eval_data, eval_config
- test_checkpoint_path – if specified, will use this model instead of model in model_dir in pipeline_config_path
Returns: a list of items, each item represent prediction result for one image
Raises: AssertionError
– (a) if pipeline_config_path does not exist. (b) if train_config.model_dir does not exist.
-
easy_vision.python.main.
export
(export_dir, pipeline_config_path, checkpoint_path='')[source]¶ Export model defined in pipeline_config_path
Parameters: - export_dir – base directory where the model should be exported
- pipeline_config_path – file specify proto.CvEstimator, including model_config, eval_data, eval_config
- checkpoint_path – if specified, will use this model instead of model in model_dir in pipeline_config_path
Returns: the directory where model is exported
Raises: AssertionError
– if pipeline_config_path does not exist
-
easy_vision.python.main.
predictor_evaluate
(config_path)[source]¶ Evaluator a predictor
Parameters: config_path – a path to proto.PredictorEval object Returns: a dict of evaluation metrics Raises: AssertionError
– if config_path does not exist