{"id":1898,"library":"albucore","title":"Albucore","description":"Albucore is a high-performance Python library offering optimized atomic functions for image processing in deep learning and computer vision. It serves as a foundational component for the AlbumentationsX library, automatically selecting the fastest implementation for operations using backends like NumPy and OpenCV. Currently at version 0.1.5, the library is actively maintained with frequent updates and performance enhancements.","status":"active","version":"0.1.5","language":"en","source_language":"en","source_url":"https://github.com/albumentations-team/albucore","tags":["image processing","computer vision","deep learning","performance","image augmentation","pytorch","tensorflow"],"install":[{"cmd":"pip install albucore","lang":"bash","label":"Basic Installation"},{"cmd":"pip install albucore[headless]","lang":"bash","label":"With OpenCV headless (recommended for servers/CI)"},{"cmd":"pip install albucore[gui]","lang":"bash","label":"With OpenCV GUI support (for local development)"},{"cmd":"pip install albucore[contrib]","lang":"bash","label":"With OpenCV contrib modules (GUI version)"},{"cmd":"pip install albucore[contrib-headless]","lang":"bash","label":"With OpenCV contrib modules (Headless version)"}],"dependencies":[{"reason":"Core array manipulation","package":"numpy","optional":false},{"reason":"Internal utility","package":"stringzilla","optional":false},{"reason":"Internal utility for optimized computations","package":"numkong","optional":false},{"reason":"Backend for image processing functions; installed via [headless] extra","package":"opencv-python-headless","optional":true},{"reason":"Backend for image processing functions with GUI support; installed via [gui] extra","package":"opencv-python","optional":true},{"reason":"Backend for image processing functions with contrib modules (GUI); installed via [contrib] extra","package":"opencv-contrib-python","optional":true},{"reason":"Backend for image processing functions with contrib modules (headless); installed via [contrib-headless] extra","package":"opencv-contrib-python-headless","optional":true}],"imports":[{"symbol":"multiply","correct":"from albucore import multiply"},{"note":"Most public functions are directly exported from the top-level package.","symbol":"all_functions","correct":"from albucore import *"}],"quickstart":{"code":"import numpy as np\nimport albucore\n\n# Create a sample RGB image (H, W, C) - uint8 is a supported dtype\nimage_rgb = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)\n\n# Create a sample grayscale image (H, W, 1) - explicit channel dimension is required\nimage_gray = np.random.randint(0, 256, (100, 100, 1), dtype=np.uint8)\n\n# Apply a function, e.g., multiply by a constant\nresult_rgb = albucore.multiply(image_rgb, 1.5)\nresult_gray = albucore.add(image_gray, 50)\n\nprint(f\"Original RGB shape: {image_rgb.shape}, dtype: {image_rgb.dtype}\")\nprint(f\"Result RGB shape: {result_rgb.shape}, dtype: {result_rgb.dtype}\")\nprint(f\"Original Grayscale shape: {image_gray.shape}, dtype: {image_gray.dtype}\")\nprint(f\"Result Grayscale shape: {result_gray.shape}, dtype: {result_gray.dtype}\")","lang":"python","description":"This quickstart demonstrates how to import and use a basic image processing function (`multiply` and `add`) from Albucore. It highlights the crucial image shape convention by providing examples for both RGB and grayscale images, ensuring the channel dimension is always present."},"warnings":[{"fix":"Always reshape grayscale images to `(H, W, 1)` using `np.expand_dims(image, axis=-1)` or ensure they are created with this shape. For batches, ensure shapes like `(N, H, W, C)`.","message":"Albucore strictly expects images to follow specific shape conventions, always including a channel dimension. For grayscale images, this means a shape of (H, W, 1) (Height, Width, 1 Channel), not (H, W). For RGB, it's (H, W, C).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure input images are converted to `np.uint8` or `np.float32` before passing them to Albucore functions. For float images, normalize pixel values to the expected range (e.g., [0, 1] or [0, 255]) as appropriate for the operation.","message":"Albucore functions primarily support `uint8` and `float32` dtypes for optimal performance. Using other dtypes may lead to errors or significantly degraded performance as the library might fall back to less optimized paths or raise exceptions.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}