Skip to content
bblgbrPublic

About

[TIP 2026] The official repository of the paper "Machines Serve Human: A Novel Variable Human-machine Collaborative Compression Framework"

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Machines Serve Human: A Novel Variable Human-machine Collaborative Compression Framework

Zifu Zhang, Shengxi Li, Xiancheng Sun, Mai Xu, Zhengyuan Liu, Jingyuan Xia

Official implementation of Diff-FCMH. 📄 Paper

Diff-FCMH framework

📖 Table of Contents

🔧 Requirements

conda create -n diff-fcmh python=3.8 -y
conda activate diff-fcmh
pip install 'pip==23.3.2' wheel
pip install torch==2.0.1 torchvision==0.15.2 --index-url https://download.pytorch.org/whl/cu117
pip install -r requirements.txt
pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.6'

Run the commands below from the repository root.

💻 Train

1. Prepare the datasets. We follow Adapt-ICMH for the COCO and Kodak setup.

Dataset Download Location
COCO 2017 Train / Val / Annotations data/coco/{train2017,val2017,annotations}/
Flickr 2W Author's repository / Google Drive data/flickr2w/
Kodak 24 original PNG images data/Kodak/

Use full images or 512×512 patches for human-vision training. Update dataset paths in config/machine/*.yaml and config/dataset/*.yaml as needed.

2. Train the machine-vision model. Prepare the task backbones listed below, then run:

CUDA_VISIBLE_DEVICES=0 python machine_vision.py -c config/machine/detection.yaml --checkpoint ''
CUDA_VISIBLE_DEVICES=0 python machine_vision.py -c config/machine/segmentation.yaml --checkpoint ''

3. Train the human-vision model. Prepare the detection checkpoint and download v2-1_512-ema-pruned.ckpt from Stable Diffusion 2.1 base or this community mirror. Store it outside the project and set params.sync_path in config/human/rate_*.yaml to its absolute path. This initializer is not bundled and is not needed for inference.

python scripts/prepare_filelists.py --train data/flickr2w --val data/Kodak
CUDA_VISIBLE_DEVICES=0 python train_human.py --config config/train_human_01.yaml

Use config/train_human_{01,05,1,3}.yaml for the four rate settings.

⚡ Inference

1. Prepare the checkpoints. Download checkpoints. Place the files under checkpoints/:

Task / λ_rs File under checkpoints/
Detection machine_vision/detection.pth.tar
Segmentation machine_vision/segmentation.pth.tar
Human / 0.1 human_vision/rate_01_step204999.ckpt
Human / 0.5 human_vision/rate_05_step144999.ckpt

Also place the Faster R-CNN and Mask R-CNN backbones in checkpoints/machine_vision/, named faster_rcnn_R50_FPN.pkl and mask_rcnn_R50_FPN.pkl.

2. Evaluate machine vision.

CUDA_VISIBLE_DEVICES=0 python machine_vision.py -c config/machine/detection.yaml -T -s 0.4
CUDA_VISIBLE_DEVICES=0 python machine_vision.py -c config/machine/segmentation.yaml -T -s 0.4

Use -s to select the rate. The eight paper-curve settings are 0.4, 0.45, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0.

3. Evaluate human vision.

for rate in 01 05; do
  CUDA_VISIBLE_DEVICES=0 python human_vision.py --rate "$rate" \
    --input data/Kodak --output "results/human/rate_${rate}" \
    --steps 50 --seed 231 --image-list data/kodak_paper_order.txt
  CUDA_VISIBLE_DEVICES=0 python evaluate_images.py --reference data/Kodak \
    --reconstruction "results/human/rate_${rate}"
done

The image list preserves the paper's diffusion sampling order. Outputs include reconstructed PNGs, bpp, LPIPS and NIQE. For offline NIQE evaluation, download the parameters and pass --niqe-model /path/to/niqe_modelparameters.mat.

Results matching the paper are summarized in results/README.md.

❤️ Acknowledgement

Our code builds on Adapt-ICMH, CompressAI, Detectron2, and Stable Diffusion. We thank their authors for making their work available.

📋 Citation

Please cite our paper if this code is useful for your research.

@article{zhang2025machines,
  title={Machines Serve Human: A Novel Variable Human-machine Collaborative Compression Framework},
  author={Zhang, Zifu and Li, Shengxi and Sun, Xiancheng and Xu, Mai and Liu, Zhengyuan and Xia, Jingyuan},
  journal={IEEE Transactions on Image Processing},
  year={2026}
}

About

[TIP 2026] The official repository of the paper "Machines Serve Human: A Novel Variable Human-machine Collaborative Compression Framework"

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages