GUI

The desktop GUI displays existing Collectra results using the selected pipeline’s task and artefact graph. Its scripts, styles, fonts, and image-viewer controls are bundled locally, so the GUI itself works offline. It requires pywebview, a supported native webview backend, and a desktop session.

The default Collectra installation supports the GUI without Torch or the ML backends. Install with pip install collectra (or uv sync in a source checkout). Existing results and pipeline graphs remain viewable even when the pipeline contains model tasks. Executing those tasks requires the appropriate extra: collectra[ml] for the Torch/RF-DETR/Transformers stack, or collectra[yolo] for Ultralytics. A pipeline’s own custom dependencies must also avoid requiring Torch if it is to run on a machine without Torch.

Backend licences differ: PyQt is GPLv3 or commercially licensed, even though pywebview itself is BSD-licensed. See Licensing and optional backends before choosing a backend for a distributed application.

Visual pipeline construction, training models from the GUI, and interactive clustering are planned features. See Design principles and development direction for the broader design goals and development direction.

Open results

collectra --pipeline pipeline.yaml gui
collectra --pipeline pipeline.yaml gui results/page001.collectra
collectra --pipeline pipeline.yaml gui results/page001.collectra/results.yaml
collectra --pipeline pipeline.yaml gui results
collectra --pipeline pipeline.yaml gui --help
collectra --pipeline pipeline.yaml gui --max-pixels 2048

Image and mask previews default to at most 4096 pixels on their longest edge. --max-pixels sets this limit for the session, including mask editing previews. It must be a positive integer. The original images and masks stay at full resolution, and brush positions and sizes are mapped back to source pixels. The setting is preserved when using the GUI’s restart action.

Without paths, select a results folder in the GUI. You can supply multiple result paths or parent directories. Result directories must use the extension configured by the pipeline and contain results.yaml. The GUI opens existing results; it does not run a pipeline over raw images when opening a path.

The GUI remembers the open result folders separately for each pipeline in the per-user cache directory (on macOS, ~/Library/Caches/collectra/gui-sessions). On the next launch without explicit input paths, it restores that list and opens the last active folder (or the first if that folder is unavailable). The active folder is saved in a separate small cache file each time it changes. Missing or unreadable folders are skipped. Passing paths to gui replaces the remembered session, as does choosing another folder in the GUI. The cache stores folder paths only; result data remains in its own files.

An installed pipeline command offers the same interface:

my-pipeline gui results

Open images

You can also open an image file, or a folder holding images, instead of results. Collectra turns each image into a page, and the page opens like any other. The file types accepted are the ones the pipeline reads as input; for example, the Grapto pipeline accepts .bmp, .gif, .jpeg, .jpg, .png, .tif, .tiff and .webp, in any case. Other files are skipped and counted, and hidden files (names starting with a dot) are ignored. Opening a folder looks only at the files and folders directly in it, not at its subfolders. (The run command still searches folders recursively.)

For each image, Collectra creates a folder next to it, named after the image with the pipeline’s extension, so page001.jpg becomes page001.collectra for a pipeline whose extension is collectra. The image is moved into it unchanged, so the original is no longer beside it, and a results.yaml is written that holds only that input image. No task runs, so every task shows as will run in the run button’s preview (see Running the pipeline).

  • If the name is already taken by something that is not this image’s page, the new folder is numbered: page001-2.collectra, then page001-3.collectra. A copy of the same image opened again opens the existing page instead of making another, and is left where it is.

  • If the page cannot be written, the image is put back where it was.

  • A folder named <name>.<extension> that has no results.yaml and holds exactly one image is turned into a page where it is, without copying. With no image, or with several, it is skipped and left alone.

  • Existing results are never changed. A folder that already has a results.yaml is opened as it is, and a folder with a results.yaml whose name does not end in the pipeline’s extension is never imported into.

  • One image that cannot be imported does not stop the others.

When something was imported, skipped or failed, the Load Details window opens after you choose the folder and shows a short summary, for example Imported 3 pages, opened 1 existing, skipped 2 files My Pipeline doesn't accept. It also counts folders skipped for not holding exactly one image, and lists each failure with its reason on a Failed: line. Nothing is shown when you only opened existing results. When you start the GUI from the command line with paths, the same summary is also printed in the terminal.

macOS Applications launcher

Create a clickable app for a pipeline with the Collectra icon:

collectra --pipeline pipeline.yaml install-app --name "My Pipeline"

This creates ~/Applications/My Pipeline.app. Double-click it in Finder to open the GUI without a Terminal window. You can also drag it to the Dock. The launcher uses the current Python environment and the pipeline’s absolute path, and starts with the pipeline directory as its working directory. Keep that environment and pipeline at their installed locations.

To open particular results on launch, pass their paths. To choose a destination or a custom icon, use --app-dir or --icon:

collectra --pipeline pipeline.yaml install-app results --name "My Pipeline"
collectra --pipeline pipeline.yaml install-app --name "My Pipeline" --app-dir /Applications --icon custom.icns

By default, the launcher uses icon from the pipeline entry when configured, resolving relative paths from the pipeline directory:

My Pipeline:
  type: collectra.Pipeline
  ext: collectra
  version: "1.0"
  icon: assets/pipeline.png

--icon overrides this setting. If icon is absent, the pipeline’s logo is used. Without either metadata setting, the Collectra icon is used. Icons may be .icns or PNG files; PNGs are converted to macOS icons. The command requires macOS and refuses to overwrite an existing app unless --force is supplied. For example, reinstall with install-app --name "My Pipeline" --force. The replacement is built before the existing app is replaced. Writing to /Applications requires write access; the default ~/Applications is the user’s Applications folder.

Native menus

The desktop menu bar provides the same actions as the viewer controls:

  • File: open results, reveal the current results file, and close the current tab.

  • Navigate: previous/next file, file search, artefact search, and search matches.

  • Panels: sidebar, graph, artefact/task lists, fit views, split, collapse, and remove panels.

  • Layouts: open the live layout chooser or save the current layout.

  • Tools: history and changes, statistics, and load details.

Panel actions target the last focused panel. macOS retains its standard application, Edit, and View menus. Restart the GUI to pick up menu changes.

Tools → Check for Updates… checks the pipeline directory and the imported Collectra source checkout independently. Each must have a .git directory or worktree file and a configured remote tracking branch. A packaged Collectra installation without a source checkout is reported as unavailable.

Checking fetches remote commits without changing working files. When a clean checkout is behind its remote and can fast-forward, the dialog offers an Update button. It rechecks the repository before applying the update. Local changes, diverged branches, missing tracking branches, and fetch failures are reported; the updater never resets, stashes, or merges local work. Restart the GUI after updating. Updating source does not install new Python dependencies. After a successful update, Restart Now saves pending text edits and the layout, then restarts the app with the same Python environment and pipeline. Open results and the selected page are restored from the saved session.

Text editing

Editable text, Markdown, and TEI fields autosave after half a second without typing. Unchanged content is not written again. Pending edits are also saved when leaving the editor, and page navigation waits for pending text saves. Save status and any errors appear in the editor’s header. Further edits retry a failed save.

Inline text is written to results.yaml. File-backed Markdown, TEI, and text are written to their linked files, preserving the references in results.yaml.

Workflow layouts

List layout YAML files in the pipeline entry, with paths relative to the pipeline directory:

My Pipeline:
  type: collectra.Pipeline
  ext: collectra
  version: "1.0"
  layouts:
    - layouts/default.yaml
    - layouts/review.yaml

The first entry supplies the workflow’s default layout when the user has no valid saved layout. All entries appear under <Pipeline name> Layouts in the Customize Layout menu, in metadata order. Later entries are not tried as fallback defaults. Missing or invalid defaults leave the GUI using its built-in layout.

User changes auto-save in the user’s cache directory under collectra/gui-arrangements/<pipeline name>/<pipeline path hash>.yaml. On macOS the cache directory is ~/Library/Caches. Existing layout files from the previous flat cache directory are still read, and subsequent saves use the new directory. A saved user layout takes priority over the workflow default. Copy a saved layout YAML into the pipeline directory and list it above to share it as a workflow default. Layout files contain panel splits, sizes, tabs, focus, and collapsed panels.

The Customize Layout menu also lists named YAML files from the pipeline’s user layout directory under Custom Layouts. Choose Save current layout… to save a named copy of the current arrangement. Existing names are preserved; choose a different name to save another copy. Selecting a layout makes it the current user arrangement and updates the panels in place, retaining the loaded results, sidebar filter, and selected page. Workflow layout files are never overwritten by this action.

History and Changes

Click the History and Changes icon in the top-right toolbar (or choose Tools > History and Changes) to open it. It shows which project you are in and what has changed since your last save. Open a results folder before using it.

  • What’s changed lists files that are edited, new or deleted and have not been saved yet, and says if saved versions are waiting to be shared or if updates are waiting to be received.

  • Get updates brings in the changes other people have shared. If their changes and yours are in the same place, nothing is changed and you are asked to get help.

  • Save changes asks for a message that describes your changes, then saves everything that has changed in the project.

  • Share my changes sends your saved versions to the shared copy.

Messages appear in plain words in the viewer. Actions run one at a time. Git must be installed, and signing in to the shared copy must already be set up; sign-in prompts are disabled. After getting updates, reopen the results folder to load the updated files into the viewer.

Settings

Click the cog in the top-right toolbar (or choose Tools > Settings) to see the environment variables stored for this pipeline, such as API keys. They are the same ones the env command manages (see Command Line Interface Reference).

  • Each row shows the variable’s value, whether it is kept in a file or in the system keyring, and its status: In use, Overridden by the shell (a value set in the shell is used instead), Overrides the shell (the stored value is used instead of the shell’s) or Not in the keyring on this computer.

  • Tick Override shell on a row to use the stored value even when the shell sets one. Untick it to give the shell’s value back.

  • To add a variable, or change one, type its name and value and click Save. Tick Private to keep the value in the system keyring; it is then hidden as you type and masked in the list. Private is off on computers that have no keyring.

  • The × on a row deletes that variable. Clear all deletes every variable, after asking.

Changes apply straight away, including to runs started from the window.

Running the pipeline

The play button (▶) in the panel toolbar, right after the search icon, runs the pipeline. It is enabled once the pipeline has loaded; with no page open, the panel says to open one first. Clicking it opens a small menu with Run this image and Run whole collection; clicking the button again closes the menu. While a run is going, the button shows the run’s progress instead (see below).

Run this image runs the pipeline on the page that is open. It opens a confirmation panel that lists every task of the pipeline with what the run will do:

  • will run: the task has no output on this page yet.

  • will re-run: the task has output, but a task upstream of it will run, so its input is about to change. The reason names the nearest such task.

  • skipped: the task already has output and is left alone.

The run fills in what is missing. Unless you tick Overwrite existing results (see below), the only tasks that run again are the re-run ones. These replace their existing output, including any edits you made by hand, and the panel warns you when there are any. If nothing would re-run, the panel says your edits are kept. If every task already has output, or the pipeline cannot run on this page, the panel says so and the run button in it is disabled.

The pipeline runs only on pages whose folder name ends in the pipeline’s extension (for example page.mypipe); a renamed folder, or a page made by another pipeline, is refused and left untouched. If the results were made by another pipeline, or by another version of this one, the panel warns you, and the run’s log entry notes it, but the run is not blocked. The image is read from the page’s folder.

The panel has an optional Note (at most 200 characters; whitespace is collapsed) that is saved with the run in run-log.txt. Confirm with the button labelled with the number of tasks, for example Run 3 tasks.

Run whole collection runs the pages listed in the sidebar with the pipeline’s normal multi-page run, so model tasks are batched as they are on the command line. By default it fills in only what is missing and replaces nothing on any page, not even a task that follows a missing one. The panel starts with a summary line, for example 6 pages: 2 have tasks to run, 3 are complete, 1 cannot run, then lists each task with the number of pages it runs on, for example crop — runs on 4 pages. A page that cannot run is listed with the reason and left out, while the other pages run. The panel has the same Note, which is saved in each page’s run-log.txt, and its button is labelled with the number of pages that have tasks to run, for example Run 2 pages. If no page can run, or every page that can run already has its results, the panel says so and its run button is disabled.

Both panels have a tick, Overwrite existing results. It is unticked every time a panel opens and is never remembered. Ticked, every task is run again and replaces its existing output, including edits and annotations you made there; the panel says exactly what will be replaced, for example 5 pages: 3 have results to replace, 2 run for the first time, and the label of the run button follows. A task that fails, or whose output cannot be saved, keeps its old output. Pages and tasks with no output yet simply run.

A run always rewrites a page’s results.yaml on save, even when no task ran; the command line does the same. A file written by Collectra changes only its timestamp: line, and a file with an older collectra_results_metadata: header is rewritten with the current results: header, keeping the workflow and version.

While the run goes on, a progress popover shows how many tasks are done (for the whole collection, how many pages), and the toolbar button is highlighted. Click the button again to reopen the popover. Stop asks the run to start no further task, on any page; it takes effect between tasks, so the task in progress finishes first. When the run ends, the popover shows a summary and, if the page is still the one open, it is reloaded to show the new results.

A task that fails, or whose output cannot be saved, leaves no half-finished output. If it was a re-run task, its previous output is kept, but that output may now be out of date because its input was replaced; the next run sees the task has output and does not redo it automatically. The failure is recorded in run-log.txt.

While a run is going:

  • Only one run can be active at a time.

  • The page being run cannot be edited: its text is read-only, its boxes and masks cannot be changed, and a notice in the toolbar says editing is paused until the run finishes. For Run this image, other open pages stay editable; for Run whole collection, no page in the list can be edited while it runs.

  • Restarting Collectra and installing updates are refused. Closing the window stops the run and waits up to 30 seconds for the task in progress to finish.

  • Git actions that change things (Get updates, Save changes, Share my changes) are refused for every page, because Git works on the whole project. Looking at What’s changed still works.

run-log.txt sits beside results.yaml in the page’s folder. It is append-only: each run adds one entry when it starts, with the plan, and finishes it with what happened to each task and a summary. A run of the whole collection adds one such entry to each page that is not left out. If a task replaced existing output because of the overwrite tick, its line says re-ran, replaced existing output. It is plain text, and you may edit it by hand; Collectra only ever appends to it. An example entry, for a pipeline whose crop task had no output and whose ocr task depends on it:

2026-11-11 14:30:05  started  My Pipeline 1.0
  note: after fixing the crop
  detect  planned to skip: already has output
  crop  planned to run: no output yet
  ocr  planned to rerun: upstream crop runs
  detect  skipped (kept existing output)
  crop  ran
  ocr  re-ran, replaced existing output (upstream crop ran)
  result  2 ran, 1 skipped, 0 failed, 12.3 s

The first line has the start time and the pipeline’s name and version. The note line appears only if you wrote a note, and a warning: line only if the results were made by another pipeline or version, for example warning: pipeline version 1.4.2, results made with 1.3.0. A re-run task that produced nothing keeps its output and is shown as re-ran, produced nothing, kept existing output. A task that failed is shown as failed: <reason>, and one that did not start because the run was stopped (or because an input it needs was not produced) as cancelled: <reason>; the summary then also counts failed and cancelled tasks. Entries are separated by a blank line.

To run from a terminal, keep using the run command line, which is unchanged.

Inspect and edit artefacts

Select an item and a node in its graph to inspect the corresponding artefacts. Images and crops display their source imagery, child boxes and coloured child segmentation masks. Text artefacts use the relevant text editor, and Links display their referenced targets. Hovering a child crop or segmentation strengthens its colour. Double-click a child crop or segmentation to open that instance in an artefact tab. Image views support box creation and editing. Hold Shift and drag on an image to draw a new crop using the annotation popup. Ordinary dragging pans the image; Escape cancels drawing. Shift-drag follows the toolbar drawing button’s availability rules. The clockwise rotation icon rotates the displayed image by 90 degrees and saves its orientation, together with the orientations of descendant image artefacts, in results.yaml. Crop coordinates remain relative to the original source image. Other open image panels refresh to show the new orientations. Edits are saved back to the results.

An image or crop that has collectra.Link children, such as the class given by a classifier, shows a button at the top left of the viewer for each of them, naming the Link (its key in results.yaml). Click it to choose another name from those used on this page and on the other pages of the open folder, or type a new name and press Enter. A Link whose id is its old name takes the new name as its id too. Choose Undefined to remove the Link: the delete confirmation lists anything nested under it, which is removed with it.

An image that a classifier task of the pipeline takes as input always has a button for that task, named after it (for example primary_label_type_detector: none), even when no Link has been set. Its menu lists the classes the task can give, in the task’s order; choosing one creates the Link, and later choices change it. The Link names that do not belong to a classifier are still shown, as above.

For multichannel TIFFs, the viewer uses a preview of the channels. When the channel count is divisible by three, view controls switch between RGB triplets; the preview does not rewrite the source image.

Running and training tasks are documented under Tasks. Extraction and evaluation commands are documented under Artefact Types.

Debugging and Python usage

Add --debug to enable the webview’s developer tools:

collectra --pipeline pipeline.yaml gui results --debug

The Python equivalent is:

from collectra import Pipeline

pipeline = Pipeline.from_file("pipeline.yaml")
pipeline.launch_gui("results/page001.collectra", debug=True)

Custom displays