How to use the openvino.tools.calibration.CommandLineReader.read function in openvino

To help you get started, we’ve selected a few openvino examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opencv / dldt / tools / calibration / __main__.py View on Github external
def calibrate():
    config = calibration.CommandLineReader.read()
    network = calibration.Calibrator(config).run()
    network.serialize(config.output_model)
github opencv / dldt / tools / calibration / __main__.py View on Github external
def check_accuracy():
    config = calibration.CommandLineReader.read()
    calibrator = calibration.CalibratorFactory.create(config.precision, calibration.CalibratorConfiguration(config))

    print("Collecting accuracy for {}...".format(config.model))
    result = calibrator.infer()
    print("Accuracy: {0:.4f}%".format(100.0 * result.metrics.accuracy))
github opencv / dldt / tools / calibration / __main__.py View on Github external
def collect_statistics():
    import os
    config = calibration.CommandLineReader.read()
    calibrator = calibration.CalibratorFactory.create(config.precision, calibration.CalibratorConfiguration(config))

    print("Collecting original network statistics for {}...".format(config.model))
    fp32_result = calibrator.infer(add_outputs=True, collect_aggregated_statistics=True)
    print("Original network accuracy: {0:.4f}%".format(100.0 * fp32_result.metrics.accuracy))

    output_model_file_path = \
        os.path.splitext(config.model)[0] + ("_{}_statistics_without_ignored.xml".format(config.precision.lower()) if
                                             config.ignore_layer_names else
                                             "_{}_statistics.xml".format(config.precision.lower()))
    output_weights_file_path = utils.Path.get_weights(output_model_file_path)

    quantization_levels = \
        calibrator.get_quantization_levels(calibration.CalibrationConfigurationHelper.read_ignore_layer_names(config))
    statistics = fp32_result.aggregated_statistics.get_node_statistics()
    calibrator.save(output_model_file_path, output_weights_file_path, quantization_levels, statistics)