{"id":8156,"library":"fiftyone-brain","title":"FiftyOne Brain","description":"The FiftyOne Brain extends the FiftyOne ecosystem with powerful machine learning capabilities for data curation and model analysis. It provides features like visual similarity search, text-based querying, finding unique and representative samples, detecting media quality issues, and identifying annotation mistakes. The library is actively developed, with frequent releases.","status":"active","version":"0.21.5","language":"en","source_language":"en","source_url":"https://github.com/voxel51/fiftyone-brain","tags":["computer vision","machine learning","data curation","embeddings","similarity search","visualization"],"install":[{"cmd":"pip install fiftyone-brain","lang":"bash","label":"Install fiftyone-brain"},{"cmd":"pip install fiftyone","lang":"bash","label":"Install FiftyOne (includes Brain)"}],"dependencies":[{"reason":"FiftyOne Brain is a core component and extension of FiftyOne, and is often installed alongside it or as part of it.","package":"fiftyone","optional":false},{"reason":"Required for using the 'umap' method in compute_visualization.","package":"umap-learn","optional":true}],"imports":[{"note":"The common convention is to import the brain subpackage from `fiftyone` and alias it as `fob`.","wrong":"import fiftyone_brain as fb","symbol":"fiftyone.brain","correct":"import fiftyone.brain as fob"},{"note":"Often used in conjunction with FiftyOne Brain features.","symbol":"fiftyone","correct":"import fiftyone as fo"},{"note":"Commonly used to load sample datasets for analysis with FiftyOne Brain.","symbol":"fiftyone.zoo","correct":"import fiftyone.zoo as foz"}],"quickstart":{"code":"import fiftyone as fo\nimport fiftyone.brain as fob\nimport fiftyone.zoo as foz\n\n# Load a sample dataset\ndataset = foz.load_zoo_dataset(\"quickstart\", max_samples=100)\n\n# Compute a 2D visualization of the dataset embeddings\nprint(\"Computing visualization...\")\nresults = fob.compute_visualization(\n    dataset,\n    brain_key=\"quickstart_viz\",\n    method=\"umap\" # Requires `pip install umap-learn`\n)\n\nprint(f\"Visualization results stored under brain key: {results.key}\")\n\n# You can then launch the FiftyOne App to view the visualization\n# session = fo.launch_app(dataset)\n# session.wait()\n\n# Compute visual similarity index\nprint(\"Computing similarity index...\")\nfob.compute_similarity(\n    dataset,\n    brain_key=\"quickstart_similarity\",\n    model=\"clip-vit-base32-torch\" # Requires `pip install fiftyone-embeddings`\n)\n\nprint(f\"Similarity index computed for brain key: quickstart_similarity\")","lang":"python","description":"This quickstart demonstrates how to load a dataset, compute a low-dimensional visualization of its embeddings using UMAP, and then compute a visual similarity index, which are core functionalities of FiftyOne Brain. The visualization can then be explored interactively in the FiftyOne App."},"warnings":[{"fix":"Before re-running, either delete the existing run with `dataset.delete_brain_run(\"your_brain_key\")` or provide a new, unique `brain_key`.","message":"When re-running a FiftyOne Brain method like `compute_visualization` or `compute_similarity`, if you use the same `brain_key` as a previous run, it will raise a `ValueError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install the `umap-learn` library: `pip install umap-learn`.","message":"The `compute_visualization` method, when using `method=\"umap\"`, requires the `umap-learn` package to be installed separately.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade `fiftyone-brain` to v0.21.4 or newer, or ensure `scikit-learn` is at least 1.7.0 if using an older `fiftyone-brain` version.","message":"`compute_visualization` with `TSNE` had compatibility issues with `scikit-learn` versions older than 1.7.0.","severity":"breaking","affected_versions":"<0.21.4"},{"fix":"Always provide a descriptive `brain_key` when calling `compute_visualization`, `compute_similarity`, etc., to ensure the results are saved and accessible.","message":"If a `brain_key` is not explicitly provided when computing a Brain method, the run will not be persisted on your dataset and will not be accessible via the FiftyOne App.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check the FiftyOne documentation for specific model requirements. Often, `pip install fiftyone-embeddings` or related model-specific packages are needed.","message":"To use certain embedding models with `compute_similarity` (e.g., 'clip-vit-base32-torch'), you might need to install additional FiftyOne plugins or packages like `fiftyone-embeddings`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Delete the old run before recomputing: `dataset.delete_brain_run('my_brain_key')`, or provide a new, unique `brain_key` for the current run.","cause":"You are attempting to compute a FiftyOne Brain method (e.g., `compute_visualization`, `compute_similarity`) using a `brain_key` that is already associated with an existing run on the dataset.","error":"ValueError: Brain method run with key 'my_brain_key' already exists"},{"fix":"Install the required package: `pip install umap-learn`.","cause":"You are trying to use the UMAP dimensionality reduction method in `fob.compute_visualization` but the `umap-learn` package is not installed.","error":"ModuleNotFoundError: No module named 'umap'"},{"fix":"Ensure `fiftyone-brain` is installed: `pip install fiftyone-brain`. If you have `fiftyone` installed, verify `pip show fiftyone-brain` shows it. Sometimes reinstalling `fiftyone` (`pip install --upgrade fiftyone`) can resolve component linking issues.","cause":"The `fiftyone-brain` package might not be correctly installed, or an outdated version of `fiftyone` is in use where the brain components are not properly linked or exposed.","error":"AttributeError: module 'fiftyone.brain' has no attribute 'compute_similarity' (or other Brain functions)"}]}