diff --git a/microqa/engine.py b/microqa/engine.py index 2a285ef..2dae341 100644 --- a/microqa/engine.py +++ b/microqa/engine.py @@ -157,7 +157,9 @@ def analyze_sharpness(im: Image.Image) -> float: # results across documents. We've had much more luck with a direct gradient # computation based on https://stackoverflow.com/a/26014796. grad_y, grad_x = np.gradient(np.asarray(im)) - return float(np.clip(np.quantile(np.sqrt(grad_x**2 + grad_y**2), 0.99) / 255, 0, 1)) + return float( + np.clip(np.quantile(np.sqrt(grad_x**2 + grad_y**2), 0.9999) / 255, 0, 1) + ) def compute_ocr(