You can Clone this Git.
In the subfolder 'Docker Environment' there is a Dockerfile that installs the corresponding runtime environment. Ubuntu 18.04 with Anaconda, Cuda 10.2, Python 3.6, Pytorch 1.9 and detectron2 was used. A corresponding Docker Compose file is included.
The Dockerfile can be built like this, for example:
- sudo docker build -t dla_sfda_basic <path_to_dockerfile>
We use 4 NVIDIA GeForce GTX 1080 Ti.
Download the dataset from public sources
You can create the benchmark datasets with the Python Files in /datasets. Adapt your path variables
The source models can be found here: Source Model
The models can be found here: Source-Free Adapted Model
You can use the run_inference_with_evaluation function in /dla-sfda/simple_inference.py. You have to change the Parameter depending on your System.
results = run_inference_with_evaluation(
dataset_name="name_of_dataset",
annotation_json_path="/path/to/annotation/file.json",
image_root_dln_path="/path/to/PNG/",
repo_source_root="/path/to/Folder/with/dla-sfda/",
model_config_yaml="dla-sfda/configs/your_detectron_model_config.yaml",
model_path="/path/to/model/model.pth"
)A file with the result can be found here: /log_results_source_and_adapted_models.txt
You can run /dla-sfda/train_source.py Choose the name parameter in the name function.
For that you have to adapt the paths in /dla-sfda/configs/SourceModelConfig.py and your corresponding config yaml.
You can run /dla-sfda/train_sfdla.py Choose the name parameter in the name function.
For that you have to adapt the paths in /dla-sfda/configs/SFDA_DLA_Configuration_Loader.py and your corresponding config yaml. Further hyperparameters can be controlled in /dla-sfda/train_sfdla.py main function.
If you find this code useful for your research, please consider citing:
@misc{tewes2025sfdlasourcefreedocumentlayout,
title={SFDLA: Source-Free Document Layout Analysis},
author={Sebastian Tewes and Yufan Chen and Omar Moured and Jiaming Zhang and Rainer Stiefelhagen},
year={2025},
eprint={2503.18742},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2503.18742},
}