How vt-vl-lab/ican works
Purpose and Runtime
iCAN is a TensorFlow 1.x implementation of instance-centric attention for human-object interaction (HOI) detection. It trains and runs ResNet-50 models for V-COCO and HICO-DET, combining detected humans/objects into interaction predictions. The intended stack is Python 2.7, TensorFlow 1.1/1.2, CUDA 8, and Ubuntu 16.04.
Operational Entry Points
CLI scripts are the primary interface:
• Training: tools/Train_ResNet_VCOCO.py, tools/Train_ResNet_HICO.py
• Dataset inference: tools/Test_ResNet_VCOCO.py, tools/Test_ResNet_HICO.py
• Image-folder demo: tools/Demo.py
• V-COCO evaluation/diagnosis: tools/Diagnose_VCOCO.py
tools/_init_paths.py establishes imports from lib/, separating thin command wrappers from model, network, and utility implementations.
Dataset-Specific Training and Test Orchestration
Dataset adapters in lib/models/ own graph execution, batching, checkpoint lifecycle, and result serialization for each benchmark:
• V-COCO training/testing: lib/models/train_Solver_VCOCO.py, lib/models/test_VCOCO.py
• HICO-DET training/testing: lib/models/train_Solver_HICO.py, lib/models/test_HICO.py
• Demo inference path: lib/models/test_demo.py
This is the main control boundary: tools select a dataset/model and iteration count; model modules drive TensorFlow sessions against prepared annotations and detector proposals.
iCAN Network Graphs
The core architectures are ResNet-50 HOI networks:
• lib/networks/iCAN_ResNet50_VCOCO.py
• lib/networks/iCAN_ResNet50_VCOCO_Early.py
• lib/networks/iCAN_ResNet50_HICO.py
They implement the benchmark-specific action spaces and iCAN attention/fusion variants. V-COCO has standard and early-fusion graphs; HICO-DET has a separate graph, rather than a single generic model with only configuration changes.
Detection-to-HOI Flow
Inference consumes external object detections, forms person-object candidate pairs, scores interaction classes, and writes detection results. Demo input is an image directory plus serialized detector output, producing serialized HOI output through tools/Demo.py and lib/models/test_demo.py.
Production-quality detections are expected from Detectron; the demo integrates tf-faster-rcnn. The detector integration/setup artifacts are misc/Object_Detector.py and misc/setup_demo.sh.
Data Preparation and Shared HOI Utilities
lib/ult/ult.py is the shared data/ROI and training-support layer used by model solvers. lib/ult/config.py centralizes repository paths and runtime configuration. Dataset/download setup is managed through lib/ult/Download_data.py and misc/download_training_data.sh.
Prior-based score adjustment is isolated in lib/ult/apply_prior.py, creating a clear post-network semantic constraint boundary between raw interaction scores and final HOI detections.
Evaluation, Conversion, and Analysis
V-COCO evaluation and error diagnosis use the bundled VSRL tooling:
• lib/ult/vsrl_eval.py
• lib/ult/vcoco_diagnose.py
• tools/Diagnose_VCOCO.py
HICO-DET final evaluation crosses into MATLAB-based conversion/evaluation support: misc/Generate_detection.m and lib/ult/Generate_HICO_detection.py. Thus Python/TensorFlow generates predictions, while HICO benchmark evaluation depends on external HICO-DET MATLAB code and generated detection files.
Main entry points: train_Solver_VCOCO.py V-COCO solver and test · train_Solver_HICO.py HICO solver and test · apply_prior.py Prior score adjustment · test_demo.py Demo inference runner
Components 18
Command entry points
- Training CLIs · Select V-COCO or HICO training.
tools/Train_ResNet_VCOCO.py - Dataset test CLIs · Run benchmark inference.
tools/Test_ResNet_VCOCO.py - Image-folder demo
tools/Demo.py - V-COCO diagnosis CLI
tools/Diagnose_VCOCO.py - Import path bootstrap · Adds lib/ implementations to command imports.
tools/_init_paths.py
Dataset orchestration
- V-COCO solver and test · Drives sessions, batches, checkpoints, and result serialization.
lib/models/train_Solver_VCOCO.py - HICO solver and test · Drives HICO training, inference, and serialized results.
lib/models/train_Solver_HICO.py - Demo inference runner
lib/models/test_demo.py
iCAN network graphs
- V-COCO iCAN graphs · Standard and early-fusion V-COCO action graphs.
lib/networks/iCAN_ResNet50_VCOCO.py - HICO iCAN graph · Separate HICO-DET interaction graph.
lib/networks/iCAN_ResNet50_HICO.py
Data and scoring
- ROI and training utilities · Prepares annotations, ROI inputs, and training support.
lib/ult/ult.py - Runtime configuration
lib/ult/config.py - Prior score adjustment · Applies semantic priors to raw interaction scores.
lib/ult/apply_prior.py - Training-data setup
lib/ult/Download_data.py
Evaluation and detector integration
- Detector integration · Consumes Detectron detections; demo supports tf-faster-rcnn.
misc/Object_Detector.py - V-COCO evaluation · Scores predictions and supports error diagnosis.
lib/ult/vsrl_eval.py - HICO detection conversion · Generates HICO evaluation detections.
lib/ult/Generate_HICO_detection.py - HICO MATLAB evaluation · Uses generated detection files with external HICO-DET code.
misc/Generate_detection.m
Connections 23
- Training CLIs → Import path bootstrap: bootstraps imports
- Dataset test CLIs → Import path bootstrap: bootstraps imports
- Image-folder demo → Import path bootstrap: bootstraps imports
- Training CLIs → V-COCO solver and test: V-COCO train
- Training CLIs → HICO solver and test: HICO train
- Dataset test CLIs → V-COCO solver and test: V-COCO test
- Dataset test CLIs → HICO solver and test: HICO test
- Image-folder demo → Demo inference runner: runs inference
- V-COCO solver and test → V-COCO iCAN graphs: builds and executes
- HICO solver and test → HICO iCAN graph: builds and executes
- Demo inference runner → V-COCO iCAN graphs: scores HOI pairs
- V-COCO solver and test → ROI and training utilities: batches ROIs and annotations
- HICO solver and test → ROI and training utilities: batches ROIs and annotations
- ROI and training utilities → Runtime configuration: reads paths and settings
- Detector integration → Demo inference runner: person-object proposals
- Demo inference runner → Prior score adjustment: raw interaction scores
- V-COCO solver and test → Prior score adjustment: benchmark predictions
- HICO solver and test → Prior score adjustment: benchmark predictions
- V-COCO diagnosis CLI → V-COCO evaluation: evaluates and diagnoses
- Prior score adjustment → V-COCO evaluation: final V-COCO detections
- Prior score adjustment → HICO detection conversion: final HICO detections
- HICO detection conversion → HICO MATLAB evaluation: generated detection files
- Training-data setup → ROI and training utilities: prepared training data