← Back to Blog

Circuit Extraction Notebook

This is the rendered notebook behind the circuit extraction post. It defines an end-to-end, reproducible workflow for identifying and visualizing the minimal channel-level circuit responsible for pot detection in a fine-tuned Faster R-CNN model.

The pipeline runs in six stages: environment setup and checkpoint loading; orthomosaic tiling and normalization; single-channel ablation across all 2048 ResNet Layer 4 channels; importance scoring via mAP delta; co-activation measurement (Pearson correlation across tiles above threshold); and circuit graph serialization with Plotly export. Outputs are channel_importance.npy, circuit.npy, and the interactive diagram.

Scroll within the viewer to navigate cells. Best experienced on a desktop-width screen.

Key results

The ablation identifies a sparse core of ~40 channels (out of 2048) that account for the majority of pot-detection performance. The top-5 channels alone contribute a combined mAP delta of 0.38 when ablated together. Co-activation edges above the 0.3 Pearson threshold form two primary clusters — one associated with circular rim features, one with interior fill texture — connected by a small bridge set of channels sensitive to contrast edges.