{"id":13424753,"url":"https://github.com/anuragranj/cc","last_synced_at":"2025-10-27T21:03:09.875Z","repository":{"id":64081484,"uuid":"134281587","full_name":"anuragranj/cc","owner":"anuragranj","description":"Competitive Collaboration: Joint Unsupervised Learning of Depth, Camera Motion, Optical Flow and Motion Segmentation","archived":false,"fork":false,"pushed_at":"2023-03-07T10:07:15.000Z","size":137,"stargazers_count":534,"open_issues_count":12,"forks_count":62,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-03-29T10:05:04.860Z","etag":null,"topics":["adversarial","adversarial-collaboration","camera-pose","deep-learning","depth-prediction","motion-segmentation","optical-flow","unsupervised-learning"],"latest_commit_sha":null,"homepage":"https://research.nvidia.com/publication/2018-05_Adversarial-Collaboration-Joint","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/anuragranj.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}},"created_at":"2018-05-21T14:38:11.000Z","updated_at":"2025-03-23T07:08:30.000Z","dependencies_parsed_at":"2024-01-20T19:11:08.145Z","dependency_job_id":null,"html_url":"https://github.com/anuragranj/cc","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/anuragranj%2Fcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragranj%2Fcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragranj%2Fcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragranj%2Fcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anuragranj","download_url":"https://codeload.github.com/anuragranj/cc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"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":["adversarial","adversarial-collaboration","camera-pose","deep-learning","depth-prediction","motion-segmentation","optical-flow","unsupervised-learning"],"created_at":"2024-07-31T00:00:58.795Z","updated_at":"2025-10-27T21:03:09.809Z","avatar_url":"https://github.com/anuragranj.png","language":"Python","funding_links":[],"categories":["2019","Awesome Self-Supervised Depth Estimation"],"sub_categories":[],"readme":"# Competitive Collaboration\nThis is an official repository of\n**Competitive Collaboration: Joint Unsupervised Learning of Depth, Camera Motion, Optical Flow and Motion Segmentation**. The project was formerly referred by **Adversarial Collaboration**. \n\n### News\n- **16 August '19:** `skimage` dependencies are removed in favour of `PIL`, and are supported in the [`pil` branch](https://github.com/anuragranj/cc/tree/pil). If you discover bugs, please file an issue, or send a pull request. This will eventually be merged with `master` if users are satisfied.\n- **11 March '19:** We recently ported the entire code to `pytorch-1.0`, so if you discover bugs, please file an issue.\n\n[[Project Page]](http://research.nvidia.com/publication/2018-05_Adversarial-Collaboration-Joint)\n[[Arxiv]](https://arxiv.org/abs/1805.09806)\n\n**Skip to:**\n- [Joint Unsupervised Learning of Depth, Camera Motion, Optical Flow and Motion Segmentation](#jointcc)\n- [Mixed Domain Learning using MNIST+SVHN](#mnist)\n- [Download Pretrained Models and Evaluation Data](#downloads)\n\n### Prerequisites\nPython3 and pytorch are required. Third party libraries can be installed (in a `python3 ` virtualenv) using:\n\n```bash\npip3 install -r requirements.txt\n```\n\u003ca name=\"jointcc\"\u003e\u003c/a\u003e\n## Joint Unsupervised Learning of Depth, Camera Motion, Optical Flow and Motion Segmentation\n\n### Preparing training data\n\n#### KITTI\nFor [KITTI](http://www.cvlibs.net/datasets/kitti/raw_data.php), first download the dataset using this [script](http://www.cvlibs.net/download.php?file=raw_data_downloader.zip) provided on the official website, and then run the following command.\n\n```bash\npython3 data/prepare_train_data.py /path/to/raw/kitti/dataset/ --dataset-format 'kitti' --dump-root /path/to/resulting/formatted/data/ --width 832 --height 256 --num-threads 1 --static-frames data/static_frames.txt --with-gt\n```\n\nFor testing optical flow ground truths on KITTI, download [KITTI2015](http://www.cvlibs.net/datasets/kitti/eval_scene_flow.php?benchmark=flow) dataset. You need to download 1) `stereo 2015/flow 2015/scene flow 2015` data set (2 GB), 2) `multi-view extension` (14 GB), and 3) `calibration files` (1 MB) . In addition, download semantic labels from [here](https://keeper.mpdl.mpg.de/f/239c2dda94e54c449401/?dl=1). You should have the following directory structure:\n```\nkitti2015\n  | data_scene_flow  \n  | data_scene_flow_calib\n  | data_scene_flow_multiview  \n  | semantic_labels\n```\n\n#### Cityscapes\n\nFor [Cityscapes](https://www.cityscapes-dataset.com/), download the following packages: 1) `leftImg8bit_sequence_trainvaltest.zip`, 2) `camera_trainvaltest.zip`. You will probably need to contact the administrators to be able to get it.\n\n```bash\npython3 data/prepare_train_data.py /path/to/cityscapes/dataset/ --dataset-format 'cityscapes' --dump-root /path/to/resulting/formatted/data/ --width 832 --height 342 --num-threads 1\n```\n\nNotice that for Cityscapes the `img_height` is set to 342 because we crop out the bottom part of the image that contains the car logo, and the resulting image will have height 256.\n\n### Training an experiment\n\nOnce the data are formatted following the above instructions, you should be able to run a training experiment. Every experiment you run gets logged in `experiment_recorder.md`.\n\n```bash\npython3 train.py /path/to/formatted/data --dispnet DispResNet6 --posenet PoseNetB6 \\\n  --masknet MaskNet6 --flownet Back2Future --pretrained-disp /path/to/pretrained/dispnet \\\n  --pretrained-pose /path/to/pretrained/posenet --pretrained-flow /path/to/pretrained/flownet \\\n  --pretrained-mask /path/to/pretrained/masknet -b4 -m0.1 -pf 0.5 -pc 1.0 -s0.1 -c0.3 \\\n  --epoch-size 1000 --log-output -f 0 --nlevels 6 --lr 1e-4 -wssim 0.997 --with-flow-gt \\\n  --with-depth-gt --epochs 100 --smoothness-type edgeaware  --fix-masknet --fix-flownet \\\n  --log-terminal --name EXPERIMENT_NAME\n```\n\n\nYou can then start a `tensorboard` session in this folder by\n```bash\ntensorboard --logdir=checkpoints/\n```\nand visualize the training progress by opening [https://localhost:6006](https://localhost:6006) on your browser.\n\n### Evaluation\n\nDisparity evaluation\n```bash\npython3 test_disp.py --dispnet DispResNet6 --pretrained-dispnet /path/to/dispnet --pretrained-posent /path/to/posenet --dataset-dir /path/to/KITTI_raw --dataset-list /path/to/test_files_list\n```\n\nTest file list is available in kitti eval folder. To get fair comparison with [Original paper evaluation code](https://github.com/tinghuiz/SfMLearner/blob/master/kitti_eval/eval_depth.py), don't specify a posenet. However, if you do,  it will be used to solve the scale factor ambiguity, the only ground truth used to get it will be vehicle speed which is far more acceptable for real conditions quality measurement, but you will obviously get worse results.\n\nFor pose evaluation, you need to download [KITTI Odometry](http://www.cvlibs.net/datasets/kitti/eval_odometry.php) dataset.\n```bash\npython test_pose.py pretrained/pose_model_best.pth.tar --img-width 832 --img-height 256 --dataset-dir /path/to/kitti/odometry/ --sequences 09 --posenet PoseNetB6\n```\n\nOptical Flow evaluation\n```bash\npython test_flow.py --pretrained-disp /path/to/dispnet --pretrained-pose /path/to/posenet --pretrained-mask /path/to/masknet --pretrained-flow /path/to/flownet --kitti-dir /path/to/kitti2015/dataset\n```\n\nMask evaluation\n```bash\npython test_mask.py --pretrained-disp /path/to/dispnet --pretrained-pose /path/to/posenet --pretrained-mask /path/to/masknet --pretrained-flow /path/to/flownet --kitti-dir /path/to/kitti2015/dataset\n```\n\n\u003ca name=\"mnist\"\u003e\u003c/a\u003e\n## Mixed Domain Learning using MNIST+SVHN\n\n#### Training\nFor learning classification using Competitive Collaboration with two agents, Alice and Bob, run,\n```bash\npython3 mnist.py path/to/download/mnist/svhn/datasets/ --name EXP_NAME --log-output --log-terminal --epoch-size 1000 --epochs 400 --wr 1000\n```\n\n#### Evaluation\nTo evaluate the performance of Alice, Bob and Moderator trained using CC, run,\n```bash\npython3 mnist_eval.py path/to/mnist/svhn/datasets --pretrained-alice pretrained/mnist_svhn/alice.pth.tar --pretrained-bob pretrained/mnist_svhn/bob.pth.tar --pretrained-mod pretrained/mnist_svhn/mod.pth.tar\n```\n\n\u003ca name=\"downloads\"\u003e\u003c/a\u003e\n## Downloads\n#### Pretrained Models\n- [DispNet, PoseNet, MaskNet and FlowNet](https://keeper.mpdl.mpg.de/f/72e946daa4e0481fb735/?dl=1) in joint unsupervised learning of depth, camera motion, optical flow and motion segmentation.\n- [Alice, Bob and Moderator](https://keeper.mpdl.mpg.de/f/d0c7d4ebd0d74b84bf10/?dl=1) in Mixed Domain Classification\n\n#### Evaluation Data\n- [Semantic Labels for KITTI](https://keeper.mpdl.mpg.de/f/239c2dda94e54c449401/?dl=1)\n\n## Acknowlegements\nWe thank Frederik Kunstner for verifying the convergence proofs. We are grateful to Clement Pinard for his [github repository](https://github.com/ClementPinard/SfmLearner-Pytorch). We use it as our initial code base. We thank Georgios Pavlakos for helping us with several revisions of the paper. We thank Joel Janai for preparing optical flow visualizations, and Clement Gorard for his Make3d evaluation code.\n\n\n## References\n*Anurag Ranjan, Varun Jampani, Lukas Balles, Deqing Sun, Kihwan Kim, Jonas Wulff and Michael J. Black.*  **Competitive Collaboration: Joint unsupervised learning of depth, camera motion, optical flow and motion segmentation.** CVPR 2019.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuragranj%2Fcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanuragranj%2Fcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuragranj%2Fcc/lists"}