Skip to content
/ FTR Public
forked from GaaarfieldWang/FTR

This repository contains the code for NeurIPS'25 paper: "Focus-Then-Reuse: Fast Adaptation in Visual Perturbation Environments".

Notifications You must be signed in to change notification settings

LAMDA-RL/FTR

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Focus-Then-Reuse: Fast Adaptation in Visual Perturbation Environments

This repository contains the code for the NeurIPS 2025 paper: Focus-Then-Reuse: Fast Adaptation in Visual Perturbation Environments.

Installation

You can directly install the dependencies using the provided setup.sh file.

./setup.sh

Please refer to this page to acquire the API key, and then set the environment variable DASHSCOPE_API_KEY to your API key.

export DASHSCOPE_API_KEY="your-api-key"

Please run the following command to download the pretrained SAM 2 model weights:

./src/segment-anything-2-real-time/checkpoints/download_ckpts.sh

More details can be found in the official SAM-2 repository.

Run

Below are running commands of running FTR and baseline algorithms.

  1. Train the original policy in clean environment using DrQ-v2 algorithm.

    Please replace env and task with corresponding arguments (e.g. ./scripts/train.sh franka reach).

    ./scripts/train.sh env task

    The model will be saved in ./log_dir/env_task/algorithm/time/model folder.

  2. Adapt the original policy in the perturbed environment using FTR.

    Please first refer to this page to acquire the API key, and then export DASHSCOPE_API_KEY="your-api-key".

    Then fill in the adapt-all.sh file with the corresponding model paths.

    ./scripts/adapt-all.sh
  3. To run the ablation study, please refer to ./scripts/ablation-*.sh

For more parameter settings, please refer to arguments.py.

If you encounter problems related to rendering, please refer to respiratory of DMC

Visualization

pendulum_swingup pendulum-swingup
cartpole_swingup cartpole-swingup
finger_spin finger-spin
hopper_stand hopper-stand
hopper_hop hopper-hop
cheetah_run cheetah-run
walker_walk walker-walk
walker_run walker-run
franka_reach franka-reach
franka_push franka-push
franka_door franka-door

Acknowledgements

This code is built on top of the repositorys: DMControl Generalization Benchmark and FTD.

The PPO implementation is based on The 37 Implementation Details of Proximal Policy Optimization.

The DrQ-v2 implementation is based on DrQ-v2.

The SAM implementation is based on SAM-2 real-time.

About

This repository contains the code for NeurIPS'25 paper: "Focus-Then-Reuse: Fast Adaptation in Visual Perturbation Environments".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.5%
  • Shell 1.5%
  • Cuda 1.0%