{"id":18283624,"url":"https://github.com/xovee/stcf","last_synced_at":"2025-04-05T07:30:58.585Z","repository":{"id":111915021,"uuid":"409955221","full_name":"Xovee/stcf","owner":"Xovee","description":"STCF: Spatial-Temporal Contrasting for Fine-Grained Urban Flow inference. IEEE Transactions on Big Data, 2023.","archived":false,"fork":false,"pushed_at":"2024-03-12T06:47:27.000Z","size":17597,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T23:42:08.758Z","etag":null,"topics":["contrastive-learning","fine-grained","smart-city","urban-computing","urban-flow-inference"],"latest_commit_sha":null,"homepage":"https://www.xoveexu.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xovee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-24T12:27:01.000Z","updated_at":"2024-12-05T14:28:28.000Z","dependencies_parsed_at":"2024-03-12T07:53:13.025Z","dependency_job_id":null,"html_url":"https://github.com/Xovee/stcf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fstcf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fstcf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fstcf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fstcf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xovee","download_url":"https://codeload.github.com/Xovee/stcf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305257,"owners_count":20917194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contrastive-learning","fine-grained","smart-city","urban-computing","urban-flow-inference"],"created_at":"2024-11-05T13:10:10.159Z","updated_at":"2025-04-05T07:30:53.568Z","avatar_url":"https://github.com/Xovee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STCF: Spatial-Temporal Contrasting for Fine-Grained Urban Flow Inference \n\n![](https://img.shields.io/badge/IEEE_TBD-2023-blue)\n![](https://img.shields.io/badge/python-3.9-green)\n![](https://img.shields.io/badge/tensorflow-2.9.1-green)\n![](https://img.shields.io/badge/cudatoolkit-11.2-green)\n![](https://img.shields.io/badge/cudnn-8.1.0-green)\n\n![teaser](./img/teaser.gif)\n\n**Left**: coarse-grained taxi flow map; \n**Right**: inferred fine-grained taxi flow map by STCF. \n\nThis repo provides a reference implementation of **STCF** framework described in the following paper:\n\u003e **Spatial-Temporal Contrasting for Fine-Grained Urban Flow Inference**  \n\u003e Xovee Xu, Zhiyuan Wang, Qiang Gao, Ting Zhong, Bei Hui, Fan Zhou, and Goce Trajcevski  \n\u003e IEEE Transactions on Big Data, vol. 9, no. 6, pp. 1711--1125, Nov 2023.\n\u003e https://doi.org/10.1109/TBDATA.2023.3316471\n\n## Data\n\nWe use [TaxiBJ](https://github.com/yoshall/UrbanFM) P1-P4 and [BikeNYC](https://www.ijcai.org/proceedings/2020/180) datasets.\n\nYou can download all five datasets at:\n\n- [Google Drive](https://drive.google.com/drive/folders/1_YgQfrNVrJzsyoTPvu1uhV40tnpuBYVK?usp=sharing) \n- [Baidu Drive](https://pan.baidu.com/s/1r4G4xYtAdamcBaO3V-S01w)  (password: `ndep`)\n\n## Environment\n\n[Update] Latest Tensorflow environment supported.  \nIn this repo, STCF is implemented by `Python 3.9`, `TensorFlow 2.9.1`, `cudatoolkit 11.2`, and `cudnn 8.1.0`.\nNote: above environment requires NVIDIA driver version `\u003e450.80.02`. \n\nCreate a virtual environment and install GPU-support packages via [Anaconda](https://www.anaconda.com/):\n```shell\n# create virtual environment\nconda create --name=stcf python=3.9\nconda activate stcf\nconda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0\n\n# install tensorflow==2.9.1, scikit-learn\u003e=1.0\npip install -r requirements.txt\n```\n\nIf `tensorflow` cannot identify `cudatoolkit`, try to configure the system path as shown in the `4. GPU setup` section of this [guide](https://www.tensorflow.org/install/pip).\n\n## Usage\n\n**Step 1**: Pre-train the spatial- and temporal-contrasting networks:\n```shell\n# spatial\npython code/sc_pretrain.py --dataset taxi-bj/p1 --model sc \n# temporal\npython code/tc_pretrain.py --dataset taxi-bj/p1 --model tc  \n```\n\n**Step 2**: Fine-tune the coupled network and evaluate performance:\n```shell\n# fine-tune\npython code/stcf.py --dataset taxi-bj/p1 --sc sc --tc tc --model stcf\n# evaluate\npython code/evaluate.py --dataset taxi-bj/p1 --model stcf\n```\n\nMore options are described in the code. \n\n## Cite\n\nIf you find our paper \u0026 code are helpful for your research, \nplease consider citing us :heart_decoration:\n\n```bibtex\n@article{xu2023stcf, \n  author = {Xovee Xu and Zhiyuan Wang and Qiang Gao and Ting Zhong and Bei Hui and Fan Zhou and Goce Trajcevski}, \n  title = {Spatial-Temporal Contrasting for Fine-Grained Urban Flow Inference}, \n  journal = {IEEE Transactions on Big Data}, \n  year = {2023},\n  volume = {9},\n  number = {6},\n  pages = {1711--1725},\n  doi = {10.1109/TBDATA.2023.3316471},\n}\n```\n\n## Acknowledgment\n\nWe are particularly grateful for the assistance given by Yuhao Liang and Ce Li. \nWe would like to show our gratitude to the authors of UrbanFM, \nFODE, UrbanODE, and others, for sharing their data and codes. \nWe express our gratitude to reviewers and editors for giving constructive feedbacks.\nThis work was initially submitted to a conference in January, 2021. \n\n## Contact\n\nFor any questions, \nplease open an issue or drop an email to: `xovee.xu at gmail.com`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxovee%2Fstcf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxovee%2Fstcf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxovee%2Fstcf/lists"}