def dump_bounding_box_info(image_path, predictions):
    filename = os.path.splitext(image_path)[0] + "-regions.json"
    # Make sure we can serialize our Python float values.
    for entry in predictions:
        entry["prob"] = Decimal("%.7g" % entry["prob"])

    with open(filename, "w") as f:
        f.write(json.dumps(predictions, use_decimal=True, indent=4, separators=(',', ': ')))

    print "Bounding box info saved as JSON to %s" % filename
Writes out our top predictions to a JSON file for other tools to work with.
dataset/ETHPy150Open BradNeuberg/cloudless/src/cloudless/inference/localization.py/dump_bounding_box_info