Skip to content

tlliao/Object-IR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔍 Introduction

This is the official implementation for Object-IR (PR2026).

Tianli Liao1, Ran Wang1, Siqing Zhang1, Lei Li1, Guangen Liu1, Chenyang Zhao1, Heling Cao1, Peng Li2

1College of Information Science and Engineering, Henan University of Technology

2Institute for Complexity Science, Henan University of Technology

Pipeline

image Given any aspect ratio, we construct a rigid mesh for the output resolution and estimate the grid's motion via a CNN-based regression network.

📝 Changelog

  • 2026.05.13: Some codes are modified for better re-implementation.
  • 2025.12.05: The training code, dataset and pretrained model are online.
  • 2025.11.03: The paper of the arXiv version is online.

🐍 Code

Requirement

  • python 3.8.5
  • numpy 1.24.4
  • pytorch 2.4.1
  • tensorboard 2.13.0

We implement Object-IR with one GPU of RTX3090. Refer to environment.yml for more details.

Training

Step 1: Download the dataset

First download the COCO dataset (or in Baidu Cloud, extraction code: 1205). Unzip and put the dataset in the "Data/" directory.

Step 2: Start training

Run the following command from the project root to start training:

python Codes/train.py --train_path Data/train --batch_size 16 --max_epoch 50 --gpu 0

The trained model will be saved in the "model/" directory.

Pre-trained model

The pre-trained model are available at Google Drive or Baidu Cloud (extraction code: 1205). Please download them and put them in the 'model' folder.

Testing

Run the following commands from the project root. Relative paths such as Data/test and Codes/yolo11n.pt are resolved inside this repository.

Expected test data layout:

Data/test/
  input/      # test images
  output/     # generated by test_output.py, used by test.py

Step 1: Generate the warped images

Generate retargeted images from Data/test/input. By default, the warped images are saved into Data/test/output, so they can be consumed directly by test.py.

python Codes/test_output.py --test_path Data/test --output_path Data/test/output --grid_path grid --ratio_h 1 --ratio_w 0.5 --batch_size 1 --gpu 0

Useful arguments for test_output.py:

Argument Default Description
--test_path Data/test Test dataset root. It must contain an input/ folder.
--output_path Data/test/output Folder for generated warped images.
--grid_path grid Folder for mesh visualization images.
--ratio_h 1 Output height ratio.
--ratio_w 0.5 Output width ratio.
--batch_size 1 Batch size for inference.
--gpu 0 GPU id used by CUDA.

Step 2: Calculate the distortion error

Calculate the distortion error using Data/test/input and Data/test/output. The output/ folder is not a ground-truth label folder; it should contain the warped images generated in Step 1, with the same order and count as input/.

python Codes/test.py --test_path Data/test --ratio 0.5 --batch_size 1 --gpu 0 --yolo_path Codes/yolo11n.pt

Useful arguments for test.py:

Argument Default Description
--test_path Data/test Test dataset root. It must contain both input/ and output/.
--ratio 0.5 Output width ratio used when resizing outputs for the metric. Use the same value as --ratio_w when --ratio_h is 1.
--batch_size 1 Batch size for metric calculation.
--gpu 0 GPU id used by CUDA.
--yolo_path Codes/yolo11n.pt YOLO weight file used by the distortion metric.

📚 Citation

If you have any questions, please don't hesitate to contact me.

Tianli Liao -- [email protected]

@article{liao2026object-ir,
title = {Object-IR: Leveraging object consistency and mesh deformation for self-supervised image retargeting},
author = {Tianli Liao and Ran Wang and Siqing Zhang and Lei Li and Guangen Liu and Chenyang Zhao and Heling Cao and Peng Li},
journal = {Pattern Recognition},
volume = {172},
pages = {112651},
year = {2026},
}

About

[PR2026] Official code for Object-IR: Leveraging Object Consistency and Mesh Deformation for Self-Supervised Image Retargeting

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages