├── LICENSE ├── README.md ├── code ├── .gitignore ├── README.md ├── assets │ ├── small_data │ │ ├── train_filenames.pkl │ │ └── train_models.txt │ ├── toy_data │ │ ├── test-filenames.json │ │ ├── train-filenames.json │ │ └── validation-filenames.json │ ├── transfers │ │ ├── config_prototype.py │ │ ├── config_prototype_arch_deep.py │ │ ├── config_prototype_arch_fat.py │ │ ├── config_prototype_arch_no_img_deep.py │ │ ├── config_prototype_arch_no_img_fat.py │ │ ├── config_prototype_arch_no_img_shallow.py │ │ ├── config_prototype_arch_no_img_slim.py │ │ ├── config_prototype_arch_shallow.py │ │ ├── config_prototype_arch_slim.py │ │ ├── config_prototype_chain.py │ │ ├── config_prototype_conv.py │ │ ├── config_prototype_data_check.py │ │ ├── config_prototype_data_check_gen.py │ │ ├── config_prototype_data_check_no_image.py │ │ ├── config_prototype_data_check_no_image_external.py │ │ ├── config_prototype_data_check_no_image_gen.py │ │ ├── config_prototype_data_check_no_image_trans.py │ │ ├── config_prototype_data_check_second_order.py │ │ ├── config_prototype_data_check_second_order_no_image.py │ │ ├── config_prototype_data_check_second_order_no_image_gen.py │ │ ├── config_prototype_empty.py │ │ ├── config_prototype_funnel.py │ │ ├── config_prototype_no_image_dilated_l2l2l0.py │ │ └── past │ │ │ ├── config_prototype_pix_stream_dilated_regular.py │ │ │ ├── config_prototype_pix_stream_dilated_shallow.py │ │ │ ├── config_prototype_pix_stream_l2.py │ │ │ ├── config_prototype_pix_stream_regular.py │ │ │ └── config_prototype_pix_stream_shallow.py │ └── transitivity │ │ ├── first_transfer.txt │ │ ├── second_transfer.txt │ │ ├── selected_samples.txt │ │ └── selected_samples_1k.txt ├── lib │ ├── __init__.py │ ├── data │ │ ├── __init__.py │ │ ├── camera_mean_and_std.pkl │ │ ├── class_idx.pkl │ │ ├── class_list.txt │ │ ├── input_pipeline.py │ │ ├── jigsaw_max_hamming_set.npy │ │ ├── load_ops.py │ │ ├── places_class_names.txt │ │ ├── places_class_to_keep.txt │ │ ├── prior_factor.npy │ │ ├── prior_factor_in_door.npy │ │ ├── pts_in_hull.npy │ │ ├── selected_class.npy │ │ ├── semseg_avg_inv.npy │ │ ├── semseg_prior_factor.npy │ │ ├── synset.py │ │ └── task_data_loading.py │ ├── general_utils.py │ ├── losses │ │ ├── __init__.py │ │ └── all.py │ ├── models │ │ ├── FCRN_depth.py │ │ ├── __init__.py │ │ ├── architectures.py │ │ ├── base_net.py │ │ ├── basic_feedforward.py │ │ ├── chained_transfer.py │ │ ├── constant_predictor.py │ │ ├── cycle_siamese_nets.py │ │ ├── encoder_decoder.py │ │ ├── encoder_decoder_cgan.py │ │ ├── encoder_decoder_cgan_softmax.py │ │ ├── encoder_decoder_segmentation.py │ │ ├── encoder_decoder_segmentation_semantic.py │ │ ├── encoder_decoder_softmax.py │ │ ├── encoder_decoder_softmax_colorization.py │ │ ├── fcrn.py │ │ ├── gan_discriminators.py │ │ ├── network.py │ │ ├── pairwise_siamese.py │ │ ├── perceptual_transfer.py │ │ ├── resnet.py │ │ ├── resnet_config.py │ │ ├── resnet_ff.py │ │ ├── resnet_utils.py │ │ ├── resnet_v1.py │ │ ├── sample_models.py │ │ ├── siamese_nets.py │ │ ├── transfer_models.py │ │ └── utils.py │ ├── optimizers │ │ ├── __init__.py │ │ ├── ops.py │ │ └── train_steps.py │ └── savers │ │ ├── __init__.py │ │ └── aws_saver.py ├── requirement.txt └── tools │ ├── __init__.py │ ├── chained_transfer.py │ ├── command_boot.sh │ ├── config_list.txt │ ├── config_list_fourth_order.txt │ ├── config_list_multi.txt │ ├── config_list_places_affected_fourth_order.txt │ ├── config_list_places_affected_second_order.txt │ ├── config_list_places_affected_third_order.txt │ ├── config_list_places_fourth_order.txt │ ├── config_list_places_second_order.txt │ ├── config_list_places_third_order.txt │ ├── config_list_third_order.txt │ ├── encode_inputs.py │ ├── examine_should_flip.py │ ├── extract.py │ ├── extract_downsampled_representations.py │ ├── extract_imagenet_accuracy.py │ ├── extract_losses.py │ ├── extract_losses_depth_sota.py │ ├── extract_losses_for_avg_image.py │ ├── extract_normalized_depth.py │ ├── extract_places_accuracy.py │ ├── extract_representations.py │ ├── final_first_order_rank.pkl │ ├── gen_checkpoint.py │ ├── generalization.pkl │ ├── get_mean_image.py │ ├── init_paths.py │ ├── knowledge_distill_imagenet.py │ ├── order.txt │ ├── prepare_instance.py │ ├── rand_baseline.py │ ├── ranked_first_order_transfers.pkl │ ├── run.sh │ ├── run_from_task_pool.sh │ ├── run_from_user_data.sh │ ├── run_img_task.py │ ├── run_viz_notebooks.py │ ├── run_viz_notebooks.sh │ ├── run_viz_notebooks_single.py │ ├── run_viz_notebooks_transitive.py │ ├── run_viz_single_task.py │ ├── run_viz_video.py │ ├── run_viz_video_low_sat.py │ ├── run_viz_video_old.py │ ├── script │ ├── aws_2.sh │ ├── change_epochs.sh │ ├── combine_representation_files.py │ ├── cp_single_model.py │ ├── cp_transfer_model.py │ ├── create_hyperparam_sweep.sh │ ├── generate_all_transfer_configs.sh │ ├── generate_samples_for_transitivity.py │ ├── generate_transfer_configs.py │ ├── generate_transfer_configs_fourth_order.py │ ├── generate_transfer_configs_gen.py │ ├── generate_transfer_configs_places_as_src.py │ ├── generate_transfer_configs_second_order.py │ ├── generate_transfer_configs_third_order.py │ ├── launch_imagenet_finetune.sh │ ├── launch_imagenet_rep_extract.sh │ ├── launch_imgnet_kdistill.sh │ ├── launch_instance.sh │ ├── launch_places_first_order.sh │ ├── launch_places_high_order.sh │ ├── launch_places_rep_extract.sh │ ├── launch_single_tasks.sh │ ├── launch_task_gen_rep_extract.sh │ ├── launch_tasks_from_file.sh │ ├── launch_transfer_tasks.sh │ ├── launch_transfer_tasks_fourth_order.sh │ ├── launch_transfer_tasks_full_order.sh │ ├── launch_transfer_tasks_full_order_selected.sh │ ├── launch_transfer_tasks_gen.sh │ ├── launch_transfer_tasks_high_order.sh │ ├── launch_transfer_tasks_high_order_unfinish.sh │ ├── launch_transfer_tasks_low_data_multi.sh │ ├── launch_transfer_tasks_second_order.sh │ ├── launch_transfer_tasks_second_order_random.sh │ ├── launch_transfer_tasks_third_order.sh │ ├── launch_transfer_tasks_to_places.sh │ ├── launch_transfer_viz.sh │ ├── launch_transfer_viz_second_order.sh │ ├── launch_video.sh │ ├── launch_video_first_order.sh │ ├── launch_video_fourth_order.sh │ ├── launch_video_high_order.sh │ ├── launch_video_rep_extract.sh │ ├── launch_video_second_order.sh │ ├── launch_video_third_order.sh │ ├── launch_video_unfinished.sh │ ├── list_instance_progress.py │ ├── make_config_retrain_config.py │ ├── preprocess │ │ ├── filter_files.py │ │ ├── img_info.sh │ │ ├── info │ │ │ ├── curvature.txt │ │ │ ├── depth.txt │ │ │ ├── edge.txt │ │ │ ├── edge2d.txt │ │ │ ├── keypoint.txt │ │ │ ├── keypoint2d.txt │ │ │ ├── mist.txt │ │ │ ├── normal.txt │ │ │ ├── reshade.txt │ │ │ ├── segment25d.txt │ │ │ └── segment2d.txt │ │ ├── preprocess_all_tar.py │ │ ├── preprocess_per_models.py │ │ ├── rename_all.py │ │ └── test_cpu.py │ ├── print_command.py │ ├── reboot_if_disconnected.sh │ ├── rename_all.sh │ ├── restructure_for_tensorboard.sh │ ├── run.sh │ ├── run_test.sh │ ├── temp.txt │ └── test.sh │ ├── second_order_should_flip.pkl │ ├── task_list.txt │ ├── test.py │ ├── train.py │ ├── train_3m.py │ ├── train_imagenet.py │ ├── train_places.py │ ├── transfer.py │ ├── transfer_viz.sh │ ├── utils.py │ ├── val_test.py │ ├── validate_losses_with_tf.py │ └── vid_task_viz.py ├── data ├── LICENSE ├── README.md └── assets │ ├── README.md │ ├── affinity.jpg │ ├── affinity_pre_post_AHP.jpg │ ├── cauthron_small.png │ ├── per_camera_point_count.png │ ├── per_image_distance.png │ ├── per_image_elevation.png │ ├── per_image_fov.png │ ├── per_image_obliqueness.png │ ├── per_image_point_count.png │ ├── per_image_roll.png │ ├── per_model_camera_count.png │ ├── per_model_image_count.png │ ├── per_model_point_count.png │ ├── per_point_camera_count.png │ ├── splits_taskonomy.zip │ ├── task_tree.jpg │ ├── web_frontpage.png │ └── web_frontpage_small.png ├── results ├── README.md ├── affinities │ ├── all_affinities.pkl │ ├── all_affinities_16k.pkl │ └── all_affinities_1k.pkl └── winrates │ ├── wins_vs_pixels.pkl │ ├── wins_vs_pixels_16k.pkl │ ├── wins_vs_pixels_1k.pkl │ ├── wins_vs_task.pkl │ ├── wins_vs_task_16k.pkl │ └── wins_vs_task_1k.pkl └── taskbank ├── LICENSE ├── README.md ├── assets ├── test.png ├── test_1.png ├── test_2.png └── web_assets │ ├── decoder_loss.png │ ├── distances_to_point.png │ ├── elevations.png │ ├── figure.png │ ├── losses.png │ ├── number_of_points_in_camera_view.png │ ├── obliquess.png │ ├── pseudosemantics │ ├── coco_selected_classes.txt │ └── imagenet_selected_classes.txt │ ├── rolls.png │ ├── sample_outputs.png │ ├── sbs.png │ ├── task_definitions.pdf │ ├── task_dict.png │ ├── task_dict_v.jpg │ ├── taskbank_tile_GIF.gif │ ├── taskbank_tile_GIF_crop.gif │ ├── test_pose.png │ ├── test_scene_class.png │ └── test_sf.png ├── experiments └── final │ ├── autoencoder │ └── config.py │ ├── class_1000 │ └── config.py │ ├── class_places │ └── config.py │ ├── colorization │ └── config.py │ ├── curvature │ └── config.py │ ├── denoise │ └── config.py │ ├── edge2d │ └── config.py │ ├── edge3d │ └── config.py │ ├── ego_motion │ └── config.py │ ├── fix_pose │ └── config.py │ ├── inpainting_whole │ └── config.py │ ├── jigsaw │ └── config.py │ ├── keypoint2d │ └── config.py │ ├── keypoint3d │ └── config.py │ ├── non_fixated_pose │ └── config.py │ ├── point_match │ └── config.py │ ├── reshade │ └── config.py │ ├── rgb2depth │ └── config.py │ ├── rgb2mist │ └── config.py │ ├── rgb2sfnorm │ └── config.py │ ├── room_layout │ └── config.py │ ├── segment25d │ └── config.py │ ├── segment2d │ └── config.py │ ├── segmentsemantic │ └── config.py │ └── vanishing_point │ └── config.py ├── lib ├── data │ ├── DejaVuSerifCondensed.ttf │ ├── camera_mean_and_std.pkl │ ├── class_idx.pkl │ ├── class_list.txt │ ├── jigsaw_max_hamming_set.npy │ ├── load_ops.py │ ├── places_class_names.txt │ ├── places_class_to_keep.txt │ ├── prior_factor.npy │ ├── prior_factor_in_door.npy │ ├── pts_in_hull.npy │ ├── selected_class.npy │ ├── semseg_avg_inv.npy │ ├── semseg_prior_factor.npy │ ├── synset.py │ └── task_data_loading.py ├── general_utils.py ├── losses │ └── all.py ├── models │ ├── architectures.py │ ├── base_net.py │ ├── basic_feedforward.py │ ├── cycle_siamese_nets.py │ ├── encoder_decoder.py │ ├── encoder_decoder_cgan.py │ ├── encoder_decoder_cgan_softmax.py │ ├── encoder_decoder_segmentation.py │ ├── encoder_decoder_segmentation_semantic.py │ ├── encoder_decoder_softmax.py │ ├── encoder_decoder_softmax_colorization.py │ ├── gan_discriminators.py │ ├── pairwise_siamese.py │ ├── resnet_config.py │ ├── resnet_utils.py │ ├── resnet_v1.py │ ├── sample_models.py │ ├── siamese_nets.py │ └── utils.py └── optimizers │ ├── ops.py │ └── train_steps.py ├── requirement.txt └── tools ├── download_model.sh ├── download_model_multi.sh ├── init_paths.py ├── run_img_task.py ├── run_multi_img_task.py ├── task_dict.txt ├── task_viz.py └── utils.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Stanford Vision and Learning Group 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Taskonomy: Disentangling Task Transfer Learning](https://taskonomy.vision/) 2 | 3 | This repository contains: 4 | - [pretrained models (task bank)](https://github.com/StanfordVL/taskonomy/tree/master/taskbank) [PyTorch + TensorFlow]. 5 | - [dataset](https://github.com/StanfordVL/taskonomy/tree/master/data) 6 | - [reference code](https://github.com/StanfordVL/taskonomy/tree/master/code) 7 | - [task affinity analyses and results](https://github.com/StanfordVL/taskonomy/tree/master/results) 8 | 9 | for the the following paper: 10 | 11 | #### [Taskonomy: Disentangling Task Transfer Learning](https://taskonomy.vision/) (CVPR 2018, Best Paper Award) 12 | Amir Zamir, Alexander Sax*, William Shen*, Leonidas Guibas, Jitendra Malik, Silvio Savarese. 13 | 14 | 15 | 16 | | [TASK BANK](https://github.com/StanfordVL/taskonomy/tree/master/taskbank) | [DATASET](https://github.com/StanfordVL/taskonomy/tree/master/data) | 17 | |:-----|:-----| 18 | | The `taskbank` folder contains information about our pretrained models, and scripts to download them. There are sample outputs, and links to live demos. | The `data` folder contains information and statistics about the dataset, some sample data, and [instructions for how to download the full dataset](https://docs.omnidata.vision/starter_dataset_download.html#Examples). | 19 | | [![models](taskbank/assets/web_assets/taskbank_tile_GIF_crop.gif)](https://github.com/StanfordVL/taskonomy/tree/master/taskbank) | [![cauthron](data/assets/cauthron_small.png)](https://github.com/StanfordVL/taskonomy/tree/master/data) | 20 | 21 | | [Task affinity analyses and results](https://github.com/StanfordVL/taskonomy/tree/master/results)| [Website](http://taskonomy.vision/) | 22 | |:----|:----| 23 | | This folder contains the raw and normalized data used for measuring task affinities. | The webpage of the project with links to assets and demos. | 24 | |[![task affinity analyses and results](data/assets/affinity.jpg)](https://github.com/StanfordVL/taskonomy/tree/master/results) | [![Website front page](data/assets/web_frontpage_small.png)](http://taskonomy.vision/)| 25 | 26 | 27 | 28 | 29 | 30 | 31 | ## Citation 32 | If you find the code, models, or data useful, please cite this paper: 33 | ``` 34 | @inproceedings{zamir2018taskonomy, 35 | title={Taskonomy: Disentangling Task Transfer Learning}, 36 | author={Zamir, Amir R and Sax, Alexander and and Shen, William B and Guibas, Leonidas and Malik, Jitendra and Savarese, Silvio}, 37 | booktitle={2018 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, 38 | year={2018}, 39 | organization={IEEE} 40 | } 41 | ``` 42 | 46 | -------------------------------------------------------------------------------- /code/.gitignore: -------------------------------------------------------------------------------- 1 | # Big assets 2 | 3 | 4 | notebooks 5 | 6 | assets/aws_data 7 | assets/data 8 | 9 | # Caches 10 | tools/.utils.py.swp 11 | tools/viz_*.pkl 12 | 13 | # Logs 14 | experiments/* 15 | experiments/*/logs 16 | experiments/rn2/ 17 | 18 | # Byte-compiled / optimized / DLL files 19 | __pycache__/ 20 | *.py[cod] 21 | *$py.class 22 | 23 | # C extensions 24 | *.so 25 | 26 | # Distribution / packaging 27 | .Python 28 | env/ 29 | build/ 30 | develop-eggs/ 31 | dist/ 32 | downloads/ 33 | eggs/ 34 | .eggs/ 35 | lib64/ 36 | parts/ 37 | sdist/ 38 | var/ 39 | *.egg-info/ 40 | .installed.cfg 41 | *.egg 42 | tools/matplotlib-asax/ 43 | 44 | # PyInstaller 45 | # Usually these files are written by a python script from a template 46 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 47 | *.manifest 48 | *.spec 49 | 50 | # Installer logs 51 | pip-log.txt 52 | pip-delete-this-directory.txt 53 | 54 | # Unit test / coverage reports 55 | htmlcov/ 56 | .tox/ 57 | .coverage 58 | .coverage.* 59 | .cache 60 | nosetests.xml 61 | coverage.xml 62 | *,cover 63 | .hypothesis/ 64 | 65 | # Translations 66 | *.mo 67 | *.pot 68 | 69 | # Django stuff: 70 | *.log 71 | local_settings.py 72 | 73 | # Flask stuff: 74 | instance/ 75 | .webassets-cache 76 | 77 | # Scrapy stuff: 78 | .scrapy 79 | 80 | # Sphinx documentation 81 | docs/_build/ 82 | 83 | # PyBuilder 84 | target/ 85 | 86 | # IPython Notebook 87 | .ipynb_checkpoints 88 | 89 | # pyenv 90 | .python-version 91 | 92 | # celery beat schedule file 93 | celerybeat-schedule 94 | 95 | # dotenv 96 | .env 97 | 98 | # virtualenv 99 | venv/ 100 | ENV/ 101 | 102 | # Spyder project settings 103 | .spyderproject 104 | 105 | # Rope project settings 106 | .ropeproject 107 | 108 | # Emacs temp files 109 | *~ 110 | -------------------------------------------------------------------------------- /code/README.md: -------------------------------------------------------------------------------- 1 | # TASKONOMY Code 2 | 3 | This folder contains the code used in the paper. The version of TensorFlow (0.12) is now very outdated, but we are still including the original code here for reference purposes. 4 | 5 | **The code is structured as follows** 6 | ```python 7 | experiments/ # Example configs (actual configs generated in tools/scripts/) 8 | transfers/ # Example transfer config 9 | aws_second/ # Task-specific configs used for paper 10 | final/ # Configs used for taskbank (slightly improved) 11 | lib/ # The bulk of the TF code 12 | data/ # Dataloading code 13 | losses/ # Different types of losses (e.g. for GANs) 14 | models/ # Architectures 15 | optimizers/ # Ops and train_steps. E.g. for GANs 16 | savers/ # Code for saving checkpoints to S3 17 | notebooks/ # Jupyter notebooks used for developing 18 | *.ipynb # Debugging notebooks, hyperparameter sweeps, etc 19 | analysis/ # Notebooks that analyze aggregated transfers. Early implementation of BIP solver 20 | transfer_viz/ # Visualizing results of networks with different HPs 21 | quality_control/ # Visualizing task-specific network outputs 22 | bottleneck/ # Results with different bottleneck sizes 23 | quality_control_final # Visualizing taskbank networks 24 | tools/ # Utilities 25 | scripts/ # Scripts to generate configs 26 | extract_losses.py # Compute losses on a train/val/test set 27 | train.py # Training script 28 | transfer.py # Transfer script 29 | ``` 30 | 31 | #### To create the taskonomy, we used the following procedure: 32 | 33 | 1) Create all task-specific configs (using `tools/scripts/` and saving to `experiments/`) 34 | 2) Select which config to run, then train the task-specific network using `tools/train.py` 35 | 3) Create all transfer configs (using `tools/scripts/` and saving to `experiments/`) 36 | 4) Select which config to run, then train the transfer network using `tools/transfer.py` 37 | 5) Compute losses with `extract_losses.py` 38 | 6) Generate win rates and affinities with one of the methods in `analysis/` 39 | 40 | 41 | **Note**: this folder provides the full code and additional resources for archival and information purposes only. We dont maintain the code here. For trained TASK BANK networks and demo code for running them, please see the [TASK BANK folder](https://github.com/StanfordVL/taskonomy/tree/master/taskbank). For Taskonomy dataset, please see the [DATASET folder](https://github.com/StanfordVL/taskonomy/tree/master/data). For more details and the full methodology, please see the [main paper and website](http://taskonomy.vision). 42 | 43 | ## Citation 44 | If you find the code, models, or data useful, please cite this paper: 45 | ``` 46 | @inproceedings{zamir2018taskonomy, 47 | title={Taskonomy: Disentangling Task Transfer Learning}, 48 | author={Zamir, Amir R and Sax, Alexander and and Shen, William B and Guibas, Leonidas and Malik, Jitendra and Savarese, Silvio}, 49 | booktitle={2018 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, 50 | year={2018}, 51 | organization={IEEE} 52 | } 53 | ``` 54 | -------------------------------------------------------------------------------- /code/assets/small_data/train_models.txt: -------------------------------------------------------------------------------- 1 | pa3ofhvvLzw 2 | -------------------------------------------------------------------------------- /code/assets/toy_data/test-filenames.json: -------------------------------------------------------------------------------- 1 | [ 2 | "{domain}/point_0__view_origin_camera__{domain}_nonfixated.png", 3 | "{domain}/point_0__view_first_octant_camera__{domain}_nonfixated.png", 4 | "{domain}/point_1__view_negative_z_axis_camera__{domain}_nonfixated.png", 5 | "{domain}/point_1__view_origin_camera__{domain}_nonfixated.png", 6 | "{domain}/point_1__view_seventh_octant_camera__{domain}_nonfixated.png" 7 | ] -------------------------------------------------------------------------------- /code/assets/toy_data/train-filenames.json: -------------------------------------------------------------------------------- 1 | [ 2 | "{domain}/point_0__view_origin_camera__{domain}_nonfixated.png", 3 | "{domain}/point_0__view_first_octant_camera__{domain}_nonfixated.png", 4 | "{domain}/point_1__view_negative_z_axis_camera__{domain}_nonfixated.png", 5 | "{domain}/point_1__view_origin_camera__{domain}_nonfixated.png", 6 | "{domain}/point_1__view_seventh_octant_camera__{domain}_nonfixated.png" 7 | ] -------------------------------------------------------------------------------- /code/assets/toy_data/validation-filenames.json: -------------------------------------------------------------------------------- 1 | [ 2 | "{domain}/point_0__view_origin_camera__{domain}_nonfixated.png", 3 | "{domain}/point_0__view_first_octant_camera__{domain}_nonfixated.png", 4 | "{domain}/point_1__view_negative_z_axis_camera__{domain}_nonfixated.png", 5 | "{domain}/point_1__view_origin_camera__{domain}_nonfixated.png", 6 | "{domain}/point_1__view_seventh_octant_camera__{domain}_nonfixated.png" 7 | ] -------------------------------------------------------------------------------- /code/assets/transitivity/first_transfer.txt: -------------------------------------------------------------------------------- 1 | edge3d autoencoder 2 | reshade autoencoder 3 | rgb2sfnorm autoencoder 4 | edge3d denoise 5 | keypoint3d denoise 6 | keypoint2d denoise 7 | rgb2sfnorm edge2d 8 | edge3d edge2d 9 | keypoint3d edge2d 10 | edge2d edge3d 11 | reshade edge3d 12 | keypoint2d edge3d 13 | edge2d impainting 14 | denoise impainting 15 | keypoint3d impainting 16 | keypoint3d keypoint2d 17 | autoencoder keypoint2d 18 | rgb2sfnorm keypoint2d 19 | denoise keypoint3d 20 | rgb2sfnorm keypoint3d 21 | rgb2depth keypoint3d 22 | rgb2sfnorm reshade 23 | rgb2depth reshade 24 | edge3d reshade 25 | reshade rgb2depth 26 | keypoint2d rgb2depth 27 | impainting rgb2depth 28 | keypoint2d rgb2sfnorm 29 | keypoint3d rgb2sfnorm 30 | autoencoder rgb2sfnorm 31 | -------------------------------------------------------------------------------- /code/assets/transitivity/second_transfer.txt: -------------------------------------------------------------------------------- 1 | autoencoder edge2d 2 | autoencoder keypoint3d 3 | autoencoder rgb2depth 4 | autoencoder edge2d 5 | autoencoder keypoint3d 6 | autoencoder rgb2depth 7 | autoencoder edge2d 8 | autoencoder keypoint3d 9 | autoencoder rgb2depth 10 | denoise edge2d 11 | denoise rgb2sfnorm 12 | denoise reshade 13 | denoise edge2d 14 | denoise rgb2sfnorm 15 | denoise reshade 16 | denoise edge2d 17 | denoise rgb2sfnorm 18 | denoise reshade 19 | edge2d rgb2depth 20 | edge2d reshade 21 | edge2d keypoint2d 22 | edge2d rgb2depth 23 | edge2d reshade 24 | edge2d keypoint2d 25 | edge2d rgb2depth 26 | edge2d reshade 27 | edge2d keypoint2d 28 | edge3d keypoint3d 29 | edge3d rgb2depth 30 | edge3d rgb2sfnorm 31 | edge3d keypoint3d 32 | edge3d rgb2depth 33 | edge3d rgb2sfnorm 34 | edge3d keypoint3d 35 | edge3d rgb2depth 36 | edge3d rgb2sfnorm 37 | impainting edge3d 38 | impainting rgb2sfnorm 39 | impainting reshade 40 | impainting edge3d 41 | impainting rgb2sfnorm 42 | impainting reshade 43 | impainting edge3d 44 | impainting rgb2sfnorm 45 | impainting reshade 46 | keypoint2d denoise 47 | keypoint2d edge3d 48 | keypoint2d reshade 49 | keypoint2d denoise 50 | keypoint2d edge3d 51 | keypoint2d reshade 52 | keypoint2d denoise 53 | keypoint2d edge3d 54 | keypoint2d reshade 55 | keypoint3d edge2d 56 | keypoint3d reshade 57 | keypoint3d edge3d 58 | keypoint3d edge2d 59 | keypoint3d reshade 60 | keypoint3d edge3d 61 | keypoint3d edge2d 62 | keypoint3d reshade 63 | keypoint3d edge3d 64 | reshade keypoint2d 65 | reshade keypoint3d 66 | reshade edge2d 67 | reshade keypoint2d 68 | reshade keypoint3d 69 | reshade edge2d 70 | reshade keypoint2d 71 | reshade keypoint3d 72 | reshade edge2d 73 | rgb2depth rgb2sfnorm 74 | rgb2depth edge3d 75 | rgb2depth keypoint3d 76 | rgb2depth rgb2sfnorm 77 | rgb2depth edge3d 78 | rgb2depth keypoint3d 79 | rgb2depth rgb2sfnorm 80 | rgb2depth edge3d 81 | rgb2depth keypoint3d 82 | rgb2sfnorm edge3d 83 | rgb2sfnorm reshade 84 | rgb2sfnorm denoise 85 | rgb2sfnorm edge3d 86 | rgb2sfnorm reshade 87 | rgb2sfnorm denoise 88 | rgb2sfnorm edge3d 89 | rgb2sfnorm reshade 90 | rgb2sfnorm denoise 91 | -------------------------------------------------------------------------------- /code/assets/transitivity/selected_samples.txt: -------------------------------------------------------------------------------- 1 | keypoint3d curvature reshade 2 | rgb2sfnorm curvature reshade 3 | edge3d curvature reshade 4 | rgb2mist curvature reshade 5 | impainting_whole segment2d edge2d 6 | denoise segment2d edge2d 7 | colorization segment2d edge2d 8 | keypoint2d segment2d edge2d 9 | impainting_whole denoise edge2d 10 | segment2d denoise edge2d 11 | keypoint2d denoise edge2d 12 | autoencoder denoise edge2d 13 | keypoint3d rgb2mist edge3d 14 | rgb2sfnorm rgb2mist edge3d 15 | reshade rgb2mist edge3d 16 | curvature rgb2mist edge3d 17 | keypoint3d rgb2mist segment25d 18 | edge3d rgb2mist segment25d 19 | reshade rgb2mist segment25d 20 | rgb2sfnorm rgb2mist segment25d 21 | edge3d segment25d rgb2sfnorm 22 | curvature segment25d rgb2sfnorm 23 | rgb2mist segment25d rgb2sfnorm 24 | reshade segment25d rgb2sfnorm 25 | keypoint3d reshade rgb2sfnorm 26 | rgb2mist reshade rgb2sfnorm 27 | curvature reshade rgb2sfnorm 28 | segment25d reshade rgb2sfnorm 29 | edge3d curvature rgb2mist 30 | keypoint3d curvature rgb2mist 31 | rgb2sfnorm curvature rgb2mist 32 | reshade curvature rgb2mist 33 | edge3d point_match class_1000 34 | keypoint3d point_match class_1000 35 | curvature point_match class_1000 36 | class_selected point_match class_1000 37 | rgb2mist rgb2sfnorm edge3d 38 | reshade rgb2sfnorm edge3d 39 | keypoint3d rgb2sfnorm edge3d 40 | curvature rgb2sfnorm edge3d 41 | edge3d keypoint3d vanishing_point_well_defined 42 | rgb2sfnorm keypoint3d vanishing_point_well_defined 43 | room_layout keypoint3d vanishing_point_well_defined 44 | reshade keypoint3d vanishing_point_well_defined 45 | curvature reshade rgb2mist 46 | keypoint3d reshade rgb2mist 47 | rgb2sfnorm reshade rgb2mist 48 | rgb2depth reshade rgb2mist 49 | edge3d rgb2mist reshade 50 | keypoint3d rgb2mist reshade 51 | curvature rgb2mist reshade 52 | rgb2sfnorm rgb2mist reshade 53 | curvature segmentsemantic_rb class_selected 54 | class_1000 segmentsemantic_rb class_selected 55 | point_match segmentsemantic_rb class_selected 56 | keypoint3d segmentsemantic_rb class_selected 57 | curvature rgb2sfnorm segmentsemantic_rb 58 | edge3d rgb2sfnorm segmentsemantic_rb 59 | reshade rgb2sfnorm segmentsemantic_rb 60 | keypoint3d rgb2sfnorm segmentsemantic_rb 61 | room_layout keypoint3d vanishing_point_well_defined 62 | rgb2sfnorm keypoint3d vanishing_point_well_defined 63 | reshade keypoint3d vanishing_point_well_defined 64 | edge3d keypoint3d vanishing_point_well_defined 65 | curvature edge3d class_selected 66 | keypoint3d edge3d class_selected 67 | segmentsemantic_rb edge3d class_selected 68 | class_1000 edge3d class_selected 69 | keypoint3d curvature rgb2sfnorm 70 | edge3d curvature rgb2sfnorm 71 | rgb2mist curvature rgb2sfnorm 72 | reshade curvature rgb2sfnorm 73 | segment25d keypoint3d segmentsemantic_rb 74 | reshade keypoint3d segmentsemantic_rb 75 | edge3d keypoint3d segmentsemantic_rb 76 | curvature keypoint3d segmentsemantic_rb 77 | keypoint3d point_match class_selected 78 | curvature point_match class_selected 79 | edge3d point_match class_selected 80 | class_1000 point_match class_selected 81 | segment25d rgb2sfnorm segmentsemantic_rb 82 | reshade rgb2sfnorm segmentsemantic_rb 83 | curvature rgb2sfnorm segmentsemantic_rb 84 | keypoint3d rgb2sfnorm segmentsemantic_rb 85 | reshade rgb2sfnorm non_fixated_pose 86 | fix_pose rgb2sfnorm non_fixated_pose 87 | ego_motion rgb2sfnorm non_fixated_pose 88 | room_layout rgb2sfnorm non_fixated_pose -------------------------------------------------------------------------------- /code/assets/transitivity/selected_samples_1k.txt: -------------------------------------------------------------------------------- 1 | rgb2depth segment2d autoencoder 2 | edge2d segment2d autoencoder 3 | keypoint2d segment2d autoencoder 4 | colorization segment2d autoencoder 5 | denoise segment2d autoencoder 6 | keypoint3d rgb2mist curvature 7 | reshade rgb2mist curvature 8 | edge3d rgb2mist curvature 9 | rgb2sfnorm rgb2mist curvature 10 | rgb2depth rgb2mist curvature 11 | impainting_whole keypoint2d denoise 12 | colorization keypoint2d denoise 13 | edge2d keypoint2d denoise 14 | segment2d keypoint2d denoise 15 | random keypoint2d denoise 16 | rgb2depth segment2d edge2d 17 | autoencoder segment2d edge2d 18 | impainting_whole segment2d edge2d 19 | colorization segment2d edge2d 20 | keypoint2d segment2d edge2d 21 | segment25d keypoint3d edge3d 22 | reshade keypoint3d edge3d 23 | curvature keypoint3d edge3d 24 | rgb2depth keypoint3d edge3d 25 | rgb2mist keypoint3d edge3d 26 | rgb2mist curvature keypoint2d 27 | rgb2sfnorm curvature keypoint2d 28 | reshade curvature keypoint2d 29 | denoise curvature keypoint2d 30 | colorization curvature keypoint2d 31 | edge3d reshade keypoint3d 32 | rgb2depth reshade keypoint3d 33 | curvature reshade keypoint3d 34 | rgb2mist reshade keypoint3d 35 | rgb2sfnorm reshade keypoint3d 36 | segment25d keypoint3d reshade 37 | edge3d keypoint3d reshade 38 | rgb2sfnorm keypoint3d reshade 39 | rgb2depth keypoint3d reshade 40 | rgb2mist keypoint3d reshade 41 | rgb2mist rgb2sfnorm rgb2depth 42 | edge3d rgb2sfnorm rgb2depth 43 | curvature rgb2sfnorm rgb2depth 44 | keypoint3d rgb2sfnorm rgb2depth 45 | reshade rgb2sfnorm rgb2depth 46 | edge3d keypoint3d rgb2mist 47 | segment25d keypoint3d rgb2mist 48 | rgb2sfnorm keypoint3d rgb2mist 49 | curvature keypoint3d rgb2mist 50 | reshade keypoint3d rgb2mist 51 | reshade rgb2depth rgb2sfnorm 52 | rgb2mist rgb2depth rgb2sfnorm 53 | edge3d rgb2depth rgb2sfnorm 54 | curvature rgb2depth rgb2sfnorm 55 | keypoint3d rgb2depth rgb2sfnorm 56 | rgb2depth rgb2mist room_layout 57 | edge3d rgb2mist room_layout 58 | curvature rgb2mist room_layout 59 | rgb2sfnorm rgb2mist room_layout 60 | keypoint3d rgb2mist room_layout 61 | reshade curvature segment25d 62 | rgb2mist curvature segment25d 63 | edge3d curvature segment25d 64 | rgb2sfnorm curvature segment25d 65 | rgb2depth curvature segment25d 66 | rgb2sfnorm rgb2depth segment2d 67 | curvature rgb2depth segment2d 68 | keypoint3d rgb2depth segment2d 69 | edge2d rgb2depth segment2d 70 | impainting_whole rgb2depth segment2d 71 | keypoint3d rgb2depth vanishing_point_well_defined 72 | curvature rgb2depth vanishing_point_well_defined 73 | rgb2mist rgb2depth vanishing_point_well_defined 74 | reshade rgb2depth vanishing_point_well_defined 75 | jigsaw rgb2depth vanishing_point_well_defined 76 | curvature edge3d segmentsemantic_rb 77 | reshade edge3d segmentsemantic_rb 78 | rgb2depth edge3d segmentsemantic_rb 79 | rgb2mist edge3d segmentsemantic_rb 80 | keypoint3d edge3d segmentsemantic_rb 81 | rgb2depth rgb2sfnorm class_1000 82 | edge3d rgb2sfnorm class_1000 83 | keypoint3d rgb2sfnorm class_1000 84 | segmentsemantic_rb rgb2sfnorm class_1000 85 | curvature rgb2sfnorm class_1000 86 | -------------------------------------------------------------------------------- /code/lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/__init__.py -------------------------------------------------------------------------------- /code/lib/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/__init__.py -------------------------------------------------------------------------------- /code/lib/data/camera_mean_and_std.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/camera_mean_and_std.pkl -------------------------------------------------------------------------------- /code/lib/data/class_idx.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/class_idx.pkl -------------------------------------------------------------------------------- /code/lib/data/input_pipeline.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/input_pipeline.py -------------------------------------------------------------------------------- /code/lib/data/jigsaw_max_hamming_set.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/jigsaw_max_hamming_set.npy -------------------------------------------------------------------------------- /code/lib/data/places_class_to_keep.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 1 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | 0 18 | 0 19 | 0 20 | 0 21 | 0 22 | 0 23 | 0 24 | 0 25 | 0 26 | 0 27 | 1 28 | 0 29 | 0 30 | 0 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 40 | 0 41 | 0 42 | 0 43 | 0 44 | 1 45 | 0 46 | 1 47 | 0 48 | 0 49 | 0 50 | 0 51 | 0 52 | 1 53 | 1 54 | 0 55 | 0 56 | 0 57 | 0 58 | 0 59 | 0 60 | 0 61 | 0 62 | 0 63 | 0 64 | 1 65 | 0 66 | 0 67 | 0 68 | 0 69 | 0 70 | 0 71 | 0 72 | 0 73 | 0 74 | 0 75 | 0 76 | 0 77 | 0 78 | 0 79 | 0 80 | 0 81 | 0 82 | 0 83 | 0 84 | 0 85 | 0 86 | 0 87 | 0 88 | 0 89 | 0 90 | 1 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 1 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 0 103 | 0 104 | 0 105 | 0 106 | 0 107 | 0 108 | 0 109 | 0 110 | 0 111 | 0 112 | 0 113 | 0 114 | 0 115 | 0 116 | 0 117 | 0 118 | 0 119 | 0 120 | 0 121 | 0 122 | 1 123 | 0 124 | 0 125 | 1 126 | 0 127 | 0 128 | 0 129 | 0 130 | 0 131 | 0 132 | 0 133 | 0 134 | 0 135 | 0 136 | 0 137 | 0 138 | 0 139 | 0 140 | 0 141 | 0 142 | 0 143 | 0 144 | 0 145 | 0 146 | 0 147 | 0 148 | 0 149 | 0 150 | 0 151 | 0 152 | 0 153 | 0 154 | 0 155 | 0 156 | 0 157 | 1 158 | 0 159 | 0 160 | 0 161 | 0 162 | 0 163 | 0 164 | 0 165 | 0 166 | 0 167 | 0 168 | 0 169 | 0 170 | 0 171 | 0 172 | 0 173 | 0 174 | 0 175 | 0 176 | 0 177 | 1 178 | 1 179 | 0 180 | 0 181 | 0 182 | 0 183 | 1 184 | 0 185 | 0 186 | 0 187 | 0 188 | 0 189 | 0 190 | 0 191 | 0 192 | 0 193 | 0 194 | 0 195 | 0 196 | 0 197 | 0 198 | 0 199 | 0 200 | 0 201 | 0 202 | 0 203 | 0 204 | 1 205 | 0 206 | 0 207 | 0 208 | 0 209 | 1 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 0 216 | 1 217 | 0 218 | 0 219 | 0 220 | 0 221 | 0 222 | 0 223 | 0 224 | 0 225 | 0 226 | 0 227 | 0 228 | 0 229 | 0 230 | 0 231 | 0 232 | 0 233 | 0 234 | 0 235 | 0 236 | 0 237 | 0 238 | 0 239 | 0 240 | 0 241 | 1 242 | 1 243 | 0 244 | 0 245 | 0 246 | 0 247 | 0 248 | 0 249 | 0 250 | 0 251 | 0 252 | 0 253 | 0 254 | 1 255 | 0 256 | 0 257 | 0 258 | 0 259 | 0 260 | 0 261 | 0 262 | 0 263 | 0 264 | 0 265 | 0 266 | 0 267 | 0 268 | 0 269 | 0 270 | 1 271 | 0 272 | 0 273 | 0 274 | 0 275 | 0 276 | 0 277 | 0 278 | 0 279 | 0 280 | 0 281 | 0 282 | 1 283 | 0 284 | 0 285 | 0 286 | 1 287 | 0 288 | 0 289 | 0 290 | 0 291 | 0 292 | 0 293 | 0 294 | 0 295 | 0 296 | 0 297 | 0 298 | 0 299 | 0 300 | 0 301 | 0 302 | 0 303 | 0 304 | 1 305 | 0 306 | 0 307 | 0 308 | 0 309 | 0 310 | 0 311 | 0 312 | 1 313 | 0 314 | 0 315 | 0 316 | 0 317 | 0 318 | 1 319 | 0 320 | 0 321 | 0 322 | 0 323 | 0 324 | 0 325 | 0 326 | 0 327 | 0 328 | 0 329 | 1 330 | 0 331 | 0 332 | 0 333 | 0 334 | 0 335 | 0 336 | 0 337 | 0 338 | 0 339 | 0 340 | 0 341 | 0 342 | 0 343 | 0 344 | 1 345 | 0 346 | 0 347 | 0 348 | 0 349 | 0 350 | 0 351 | 0 352 | 0 353 | 0 354 | 0 355 | 0 356 | 0 357 | 0 358 | 0 359 | 1 360 | 0 361 | 0 362 | 0 363 | 0 364 | 1 365 | 0 366 | -------------------------------------------------------------------------------- /code/lib/data/prior_factor.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/prior_factor.npy -------------------------------------------------------------------------------- /code/lib/data/prior_factor_in_door.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/prior_factor_in_door.npy -------------------------------------------------------------------------------- /code/lib/data/pts_in_hull.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/pts_in_hull.npy -------------------------------------------------------------------------------- /code/lib/data/selected_class.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/selected_class.npy -------------------------------------------------------------------------------- /code/lib/data/semseg_avg_inv.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/semseg_avg_inv.npy -------------------------------------------------------------------------------- /code/lib/data/semseg_prior_factor.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/data/semseg_prior_factor.npy -------------------------------------------------------------------------------- /code/lib/general_utils.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Defines general utility functions 3 | ''' 4 | from models.architectures import ALLOWABLE_TYPES as ALLOWABLE_MODEL_TYPES 5 | 6 | import os 7 | 8 | 9 | ############################# 10 | # Dynamically set variables 11 | ############################# 12 | class RuntimeDeterminedEnviromentVars( object ): 13 | ''' 14 | Example use: 15 | inputs = { 'num_samples_epoch': 100 } 16 | cfg = { 'batch_size': 5, 'epoch_steps': [ '', 'steps_per_epoch' ] } 17 | 18 | for key, value in cfg.items(): 19 | if isinstance( value, list ) and len( value ) == 2 and value[0] == 'LOAD_DYNAMIC': 20 | RuntimeDeterminedEnviromentVars.register( cfg, key, value[1] ) 21 | 22 | RuntimeDeterminedEnviromentVars.load_dynamic_variables( inputs, cfg ) 23 | RuntimeDeterminedEnviromentVars.populate_registered_variables() 24 | print( cfg ) # epoch_steps = 20 25 | ''' 26 | registered_variables = [] 27 | is_loaded = False 28 | # These are initialized in load_dynamic_variables 29 | steps_per_epoch = '' # An int that condains the number of steps the network will take per epoch 30 | 31 | @classmethod 32 | def load_dynamic_variables( cls, inputs, cfg ): 33 | ''' 34 | Args: 35 | inputs: a dict from train.py 36 | cfg: a dict from a config.py 37 | ''' 38 | cls.steps_per_epoch = inputs[ 'num_samples_epoch' ] // cfg[ 'batch_size' ] 39 | cls.is_loaded = True 40 | 41 | @classmethod 42 | def register( cls, dict_containing_field_to_populate, field_name, attr_name ): 43 | cls.registered_variables.append( [dict_containing_field_to_populate, field_name, attr_name] ) 44 | 45 | @classmethod 46 | def register_dict( cls, dict_to_register ): 47 | ''' 48 | Registers any fields in the dict that should be dynamically loaded. 49 | Such fields should have value: [ '', attr_name ] 50 | ''' 51 | for key, value in dict_to_register.items(): 52 | if isinstance( value, list ) and len( value ) == 2 and value[0] == '': 53 | cls.register( dict_to_register, key, value[1] ) 54 | elif isinstance( value, dict ): 55 | cls.register_dict( value ) 56 | 57 | @classmethod 58 | def populate_registered_variables( cls ): 59 | print( "dynamically populating variables:" ) 60 | for dict_containing_field_to_populate, field_name, attr_name in cls.registered_variables: 61 | dict_containing_field_to_populate[field_name] = getattr( cls, attr_name ) 62 | print( "\t{0}={1}".format( field_name, getattr( cls, attr_name ) ) ) 63 | 64 | 65 | ########################### 66 | # Utility functions 67 | ########################### 68 | def validate_config( cfg ): 69 | ''' 70 | Catches many general cfg errors. 71 | ''' 72 | if cfg[ 'model_type' ] not in ALLOWABLE_MODEL_TYPES: 73 | raise ValueError( "'model_type' in config.py must be one of {0}".format( ALLOWABLE_MODEL_TYPES )) 74 | if cfg[ 'model_type' ] is not 'empty' and 'optimizer' not in cfg: 75 | raise ValueError( "an 'optimizer' must be specified".format( ALLOWABLE_MODEL_TYPES )) 76 | if 'optimizer' in cfg and 'optimizer_kwargs' not in cfg: 77 | raise ValueError( "The arguments for the optimizer {0} must be given, named, in 'optimizer_kwargs'".format( cfg[ 'optimizer' ] )) 78 | 79 | 80 | def load_config( cfg_dir, nopause=False ): 81 | ''' 82 | Raises: 83 | FileNotFoundError if 'config.py' doesn't exist in cfg_dir 84 | ''' 85 | if not os.path.isfile( os.path.join( cfg_dir, 'config.py' ) ): 86 | raise ImportError( 'config.py not found in {0}'.format( cfg_dir ) ) 87 | import sys 88 | try: 89 | del sys.modules[ 'config' ] 90 | except: 91 | pass 92 | 93 | sys.path.insert( 0, cfg_dir ) 94 | import config as loading_config 95 | # cleanup 96 | # print([ v for v in sys.modules if "config" in v]) 97 | # return 98 | cfg = loading_config.get_cfg( nopause ) 99 | 100 | try: 101 | del sys.modules[ 'config' ] 102 | except: 103 | pass 104 | sys.path.remove(cfg_dir) 105 | 106 | return cfg 107 | 108 | def update_keys(old_dict, key_starts_with, new_dict): 109 | for k, v in new_dict.items(): 110 | if k.startswith(key_starts_with): 111 | old_dict[k] = v 112 | return old_dict -------------------------------------------------------------------------------- /code/lib/losses/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/losses/__init__.py -------------------------------------------------------------------------------- /code/lib/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/models/__init__.py -------------------------------------------------------------------------------- /code/lib/models/architectures.py: -------------------------------------------------------------------------------- 1 | ''' architectures.py 2 | 3 | Contains high-level model architectures assembled from smaller parts 4 | ''' 5 | from __future__ import absolute_import, division, print_function 6 | 7 | import argparse 8 | import os 9 | import tensorflow as tf 10 | import tensorflow.contrib.slim as slim 11 | 12 | from models.encoder_decoder import StandardED as EncoderDecoder 13 | from models.encoder_decoder_cgan import EDWithCGAN as EncoderDecoderWithCGAN 14 | from models.encoder_decoder_cgan_softmax import EDWithSoftmaxRegenerationCGAN as EDSoftmaxRegenCGAN 15 | from models.siamese_nets import StandardSiamese as Siamese 16 | from models.cycle_siamese_nets import CycleSiamese as CycleSiamese 17 | from models.basic_feedforward import StandardFeedforward as BasicFF 18 | from models.encoder_decoder_segmentation import SegmentationED as SegmentationEncoderDecoder 19 | 20 | from models.encoder_decoder_segmentation_semantic import SemSegED 21 | from models.encoder_decoder_softmax import SoftmaxED as EDSoftmax 22 | from models.perceptual_transfer import TransferNet 23 | from models.chained_transfer import ChainedTransferNet 24 | from models.constant_predictor import ConstantPredictorSegmentation, ConstantPredictorPose, ConstantPredictorL2 25 | from models.resnet_ff import ResNet_FF 26 | from models.FCRN_depth import FCRN_depth 27 | 28 | ALLOWABLE_TYPES = [ 29 | BasicFF, 30 | CycleSiamese, 31 | EncoderDecoderWithCGAN, 32 | EncoderDecoder, 33 | EDSoftmax, 34 | EDSoftmaxRegenCGAN, 35 | ResNet_FF, 36 | SegmentationEncoderDecoder, 37 | SemSegED, 38 | Siamese, 39 | ConstantPredictorSegmentation, 40 | ConstantPredictorPose, 41 | ConstantPredictorL2, 42 | TransferNet, 43 | ChainedTransferNet, 44 | FCRN_depth, 45 | 'empty' ] 46 | -------------------------------------------------------------------------------- /code/lib/models/base_net.py: -------------------------------------------------------------------------------- 1 | ''' 2 | General config.py options that can be used for all models. : 3 | ''' 4 | import tensorflow as tf 5 | import tensorflow.contrib.slim as slim 6 | 7 | from optimizers import ops as optimizers 8 | 9 | class BaseNet(object): 10 | 11 | def __init__(self, global_step, cfg): 12 | self.cfg = cfg 13 | self.decoder_only = False 14 | self.extended_summaries = False 15 | if 'extended_summaries' in cfg: 16 | self.extended_summaries = cfg['extended_summaries'] 17 | 18 | def build_model(self): 19 | raise NotImplementedError( 'build_model not implemented') 20 | 21 | def get_losses(self): 22 | raise NotImplementedError( 'get_losses not implemented') 23 | 24 | def build_train_op( self, global_step ): 25 | if not self.model_built or self.total_loss is None: 26 | raise RuntimeError( "Cannot build optimizers until 'build_model' ({0}) and 'get_losses' {1} are run".format( 27 | self.model_built, self.total_loss is not None ) ) 28 | self.global_step = global_step 29 | self.optimizer = optimizers.build_optimizer( global_step=global_step, cfg=self.cfg ) 30 | self.train_op = slim.learning.create_train_op( self.total_loss, self.optimizer ) 31 | 32 | def train_step(self): 33 | raise NotImplementedError( 'train_step not implemented' ) 34 | 35 | def get_train_step_fn(self): 36 | return slim.learning.train_step -------------------------------------------------------------------------------- /code/lib/models/resnet_config.py: -------------------------------------------------------------------------------- 1 | # This is a variable scope aware configuation object for TensorFlow 2 | 3 | import tensorflow as tf 4 | 5 | FLAGS = tf.app.flags.FLAGS 6 | 7 | class Config: 8 | def __init__(self): 9 | root = self.Scope('') 10 | for k, v in FLAGS.__dict__['__flags'].items(): 11 | root[k] = v 12 | self.stack = [ root ] 13 | 14 | def iteritems(self): 15 | return self.to_dict().items() 16 | 17 | def to_dict(self): 18 | self._pop_stale() 19 | out = {} 20 | # Work backwards from the flags to top fo the stack 21 | # overwriting keys that were found earlier. 22 | for i in range(len(self.stack)): 23 | cs = self.stack[-i] 24 | for name in cs: 25 | out[name] = cs[name] 26 | return out 27 | 28 | def _pop_stale(self): 29 | var_scope_name = tf.get_variable_scope().name 30 | top = self.stack[0] 31 | while not top.contains(var_scope_name): 32 | # We aren't in this scope anymore 33 | self.stack.pop(0) 34 | top = self.stack[0] 35 | 36 | def __getitem__(self, name): 37 | self._pop_stale() 38 | # Recursively extract value 39 | for i in range(len(self.stack)): 40 | cs = self.stack[i] 41 | if name in cs: 42 | return cs[name] 43 | 44 | raise KeyError(name) 45 | 46 | def set_default(self, name, value): 47 | if not name in self: 48 | self[name] = value 49 | 50 | def __contains__(self, name): 51 | self._pop_stale() 52 | for i in range(len(self.stack)): 53 | cs = self.stack[i] 54 | if name in cs: 55 | return True 56 | return False 57 | 58 | def __setitem__(self, name, value): 59 | self._pop_stale() 60 | top = self.stack[0] 61 | var_scope_name = tf.get_variable_scope().name 62 | assert top.contains(var_scope_name) 63 | 64 | if top.name != var_scope_name: 65 | top = self.Scope(var_scope_name) 66 | self.stack.insert(0, top) 67 | 68 | top[name] = value 69 | 70 | class Scope(dict): 71 | def __init__(self, name): 72 | self.name = name 73 | 74 | def contains(self, var_scope_name): 75 | return var_scope_name.startswith(self.name) 76 | 77 | 78 | 79 | # Test 80 | if __name__ == '__main__': 81 | 82 | def assert_raises(exception, fn): 83 | try: 84 | fn() 85 | except exception: 86 | pass 87 | else: 88 | assert False, "Expected exception" 89 | 90 | c = Config() 91 | 92 | c['hello'] = 1 93 | assert c['hello'] == 1 94 | 95 | with tf.variable_scope('foo'): 96 | c.set_default("bar", 10) 97 | c['bar'] = 2 98 | assert c['bar'] == 2 99 | assert c['hello'] == 1 100 | 101 | c.set_default("mario", True) 102 | 103 | with tf.variable_scope('meow'): 104 | c['dog'] = 3 105 | assert c['dog'] == 3 106 | assert c['bar'] == 2 107 | assert c['hello'] == 1 108 | 109 | assert c['mario'] == True 110 | 111 | assert_raises(KeyError, lambda: c['dog']) 112 | assert c['bar'] == 2 113 | assert c['hello'] == 1 114 | 115 | 116 | -------------------------------------------------------------------------------- /code/lib/optimizers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/optimizers/__init__.py -------------------------------------------------------------------------------- /code/lib/savers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/savers/__init__.py -------------------------------------------------------------------------------- /code/lib/savers/aws_saver.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Implements a saver which first saves locally, and then uses aws-cli to push it to S3. 3 | ''' 4 | 5 | from __future__ import absolute_import, division, print_function 6 | 7 | import argparse 8 | import os 9 | import tensorflow as tf 10 | import tempfile 11 | import glob 12 | import pdb 13 | import subprocess 14 | 15 | ### VERY BAD HACKS 16 | ### TODO: REMOVE 17 | S3_MOUNT_POINT = '/home/ubuntu/s3' 18 | S3_MOUNTED_BUCKET = 'task-preprocessing-512-oregon' 19 | 20 | class AwsSaver(tf.train.Saver): 21 | """Saves and restores variables.""" 22 | 23 | def save(self, sess, save_path, **kwargs): 24 | dirs, fname = os.path.split(save_path) 25 | dst_dir = dirs.replace( 26 | S3_MOUNT_POINT, 27 | "s3://{}".format(S3_MOUNTED_BUCKET) ) 28 | 29 | # Save locally 30 | tmp_path = os.path.join(tempfile.gettempdir(), fname) 31 | model_checkpoint_path = super(AwsSaver, self).save(sess, tmp_path, **kwargs) 32 | print(model_checkpoint_path) 33 | _, curr_ckpt_fname = os.path.split(model_checkpoint_path) 34 | # Move to AWS 35 | ckpt_files = glob.glob(tmp_path + '*') 36 | for ckpt_file in ckpt_files: 37 | _, fname = os.path.split(ckpt_file) 38 | tmp_path = os.path.join(tempfile.gettempdir(), fname) 39 | 40 | aws_mv_command = "aws s3 mv {} {}".format( 41 | tmp_path, 42 | os.path.join(dst_dir, fname)) 43 | 44 | subprocess.call(aws_mv_command, shell=True) 45 | 46 | # Get current s3 checkpoint path and delete old ones 47 | curr_ckpt_path = os.path.join(dirs, curr_ckpt_fname) 48 | self._MaybeDeleteOldCheckpoints(curr_ckpt_path) 49 | 50 | # Update the checkpoint file 51 | ckpt_state = tf.train.get_checkpoint_state(dirs) 52 | all_model_checkpoint_paths = None 53 | if ckpt_state is not None: 54 | all_model_checkpoint_paths = ckpt_state.all_model_checkpoint_paths 55 | tf.train.update_checkpoint_state( 56 | dirs, 57 | curr_ckpt_path, 58 | all_model_checkpoint_paths) 59 | -------------------------------------------------------------------------------- /code/requirement.txt: -------------------------------------------------------------------------------- 1 | anaconda-client==1.6.0 2 | backports-abc==0.5 3 | backports.shutil-get-terminal-size==1.0.0 4 | backports.ssl-match-hostname==3.4.0.2 5 | clyent==1.2.2 6 | configparser==3.5.0 7 | cube2sphere==0.1.8 8 | cycler==0.10.0 9 | decorator==4.0.10 10 | enum34==1.1.6 11 | funcsigs==1.0.2 12 | functools32==3.2.3.post2 13 | ipykernel==4.5.2 14 | ipython==5.3.0 15 | ipython-genutils==0.2.0 16 | ipywidgets==5.2.2 17 | Jinja2==2.8 18 | jsonschema==2.5.1 19 | jupyter==1.0.0 20 | jupyter-client==4.4.0 21 | jupyter-console==5.0.0 22 | jupyter-core==4.2.1 23 | MarkupSafe==0.23 24 | matplotlib==1.5.3 25 | mistune==0.7.3 26 | mock==2.0.0 27 | nb-anacondacloud==1.2.0 28 | nb-conda==2.0.0 29 | nb-conda-kernels==2.0.0 30 | nbconvert==4.2.0 31 | nbformat==4.2.0 32 | nbpresent==3.0.2 33 | networkx==1.11 34 | notebook==4.3.0 35 | numpy==1.11.2 36 | path.py==0.0.0 37 | pathlib2==2.2.1 38 | pbr==1.10.0 39 | pexpect==4.0.1 40 | pickleshare==0.7.4 41 | Pillow==3.4.2 42 | prompt-toolkit==1.0.13 43 | protobuf==3.1.0 44 | ptyprocess==0.5.1 45 | pycairo==1.10.0 46 | Pygments==2.2.0 47 | pyparsing==2.1.4 48 | python-dateutil==2.6.0 49 | pytz==2016.10 50 | PyYAML==3.12 51 | pyzmq==16.0.2 52 | qtconsole==4.2.1 53 | requests==2.12.4 54 | scandir==1.5 55 | scikit-image==0.12.3 56 | scikit-learn==0.18.1 57 | scipy==0.18.1 58 | simplegeneric==0.8.1 59 | singledispatch==3.4.0.3 60 | six==1.10.0 61 | tensorflow-gpu==0.12.0rc1 62 | terminado==0.6 63 | tornado==4.4.2 64 | traitlets==4.3.2 65 | transforms3d==0.3 66 | wcwidth==0.1.7 67 | widgetsnbextension==1.2.6 68 | -------------------------------------------------------------------------------- /code/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/tools/__init__.py -------------------------------------------------------------------------------- /code/tools/command_boot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | screen -dm bash -c "source /home/ubuntu/.bashrc; sleep 10; /home/ubuntu/task-taxonomy-331b/tools/run_from_task_pool.sh --resume; exec sh" 3 | -------------------------------------------------------------------------------- /code/tools/config_list_places_affected_second_order.txt: -------------------------------------------------------------------------------- 1 | rgb2sfnorm__class_places__segmentsemantic_rb__8__unlocked \ 2 | curvature__class_places__segmentsemantic_rb__8__unlocked \ 3 | keypoint3d__class_places__segmentsemantic_rb__8__unlocked \ 4 | reshade__class_places__segmentsemantic_rb__8__unlocked \ 5 | rgb2sfnorm__class_places__non_fixated_pose__8__unlocked \ 6 | fix_pose__class_places__non_fixated_pose__8__unlocked \ 7 | vanishing_point_well_defined__class_places__non_fixated_pose__8__unlocked \ 8 | ego_motion__class_places__non_fixated_pose__8__unlocked \ 9 | rgb2sfnorm__class_places__segmentsemantic_rb__8__unlocked \ 10 | curvature__class_places__segmentsemantic_rb__8__unlocked \ 11 | keypoint3d__class_places__segmentsemantic_rb__8__unlocked \ 12 | reshade__class_places__segmentsemantic_rb__8__unlocked \ 13 | rgb2sfnorm__class_places__non_fixated_pose__8__unlocked \ 14 | fix_pose__class_places__non_fixated_pose__8__unlocked \ 15 | vanishing_point_well_defined__class_places__non_fixated_pose__8__unlocked \ 16 | ego_motion__class_places__non_fixated_pose__8__unlocked \ 17 | rgb2sfnorm__class_places__non_fixated_pose__8__unlocked \ 18 | fix_pose__class_places__non_fixated_pose__8__unlocked \ 19 | vanishing_point_well_defined__class_places__non_fixated_pose__8__unlocked \ 20 | ego_motion__class_places__non_fixated_pose__8__unlocked \ 21 | rgb2sfnorm__class_places__segmentsemantic_rb__8__unlocked \ 22 | curvature__class_places__segmentsemantic_rb__8__unlocked \ 23 | keypoint3d__class_places__segmentsemantic_rb__8__unlocked \ 24 | reshade__class_places__segmentsemantic_rb__8__unlocked \ 25 | rgb2sfnorm__class_places__non_fixated_pose__8__unlocked \ 26 | fix_pose__class_places__non_fixated_pose__8__unlocked \ 27 | vanishing_point_well_defined__class_places__non_fixated_pose__8__unlocked \ 28 | ego_motion__class_places__non_fixated_pose__8__unlocked \ 29 | rgb2sfnorm__class_places__segmentsemantic_rb__8__unlocked \ 30 | curvature__class_places__segmentsemantic_rb__8__unlocked \ 31 | keypoint3d__class_places__segmentsemantic_rb__8__unlocked \ 32 | reshade__class_places__segmentsemantic_rb__8__unlocked \ 33 | rgb2sfnorm__class_places__segmentsemantic_rb__8__unlocked \ 34 | curvature__class_places__segmentsemantic_rb__8__unlocked \ 35 | keypoint3d__class_places__segmentsemantic_rb__8__unlocked \ 36 | reshade__class_places__segmentsemantic_rb__8__unlocked \ 37 | rgb2sfnorm__class_places__non_fixated_pose__8__unlocked \ 38 | fix_pose__class_places__non_fixated_pose__8__unlocked \ 39 | vanishing_point_well_defined__class_places__non_fixated_pose__8__unlocked \ 40 | ego_motion__class_places__non_fixated_pose__8__unlocked \ 41 | rgb2sfnorm__class_places__non_fixated_pose__8__unlocked \ 42 | fix_pose__class_places__non_fixated_pose__8__unlocked \ 43 | vanishing_point_well_defined__class_places__non_fixated_pose__8__unlocked \ 44 | ego_motion__class_places__non_fixated_pose__8__unlocked \ 45 | rgb2sfnorm__class_places__segmentsemantic_rb__8__unlocked \ 46 | curvature__class_places__segmentsemantic_rb__8__unlocked \ 47 | keypoint3d__class_places__segmentsemantic_rb__8__unlocked \ 48 | reshade__class_places__segmentsemantic_rb__8__unlocked \ 49 | -------------------------------------------------------------------------------- /code/tools/config_list_places_second_order.txt: -------------------------------------------------------------------------------- 1 | class_1000__class_selected__class_places__8__unlocked \ 2 | class_1000__edge3d__class_places__8__unlocked \ 3 | class_1000__segmentsemantic_rb__class_places__8__unlocked \ 4 | class_1000__curvature__class_places__8__unlocked \ 5 | class_selected__edge3d__class_places__8__unlocked \ 6 | class_selected__segmentsemantic_rb__class_places__8__unlocked \ 7 | class_selected__curvature__class_places__8__unlocked \ 8 | edge3d__segmentsemantic_rb__class_places__8__unlocked \ 9 | edge3d__curvature__class_places__8__unlocked \ 10 | segmentsemantic_rb__curvature__class_places__8__unlocked \ 11 | class_1000__class_selected__class_places__8__unlocked \ 12 | class_1000__edge3d__class_places__8__unlocked \ 13 | class_1000__segmentsemantic_rb__class_places__8__unlocked \ 14 | class_1000__curvature__class_places__8__unlocked \ 15 | class_selected__edge3d__class_places__8__unlocked \ 16 | class_selected__segmentsemantic_rb__class_places__8__unlocked \ 17 | class_selected__curvature__class_places__8__unlocked \ 18 | edge3d__segmentsemantic_rb__class_places__8__unlocked \ 19 | edge3d__curvature__class_places__8__unlocked \ 20 | segmentsemantic_rb__curvature__class_places__8__unlocked \ 21 | class_1000__class_selected__class_places__8__unlocked \ 22 | class_1000__edge3d__class_places__8__unlocked \ 23 | class_1000__segmentsemantic_rb__class_places__8__unlocked \ 24 | class_1000__curvature__class_places__8__unlocked \ 25 | class_selected__edge3d__class_places__8__unlocked \ 26 | class_selected__segmentsemantic_rb__class_places__8__unlocked \ 27 | class_selected__curvature__class_places__8__unlocked \ 28 | edge3d__segmentsemantic_rb__class_places__8__unlocked \ 29 | edge3d__curvature__class_places__8__unlocked \ 30 | segmentsemantic_rb__curvature__class_places__8__unlocked \ 31 | class_1000__class_selected__class_places__8__unlocked \ 32 | class_1000__edge3d__class_places__8__unlocked \ 33 | class_1000__segmentsemantic_rb__class_places__8__unlocked \ 34 | class_1000__curvature__class_places__8__unlocked \ 35 | class_selected__edge3d__class_places__8__unlocked \ 36 | class_selected__segmentsemantic_rb__class_places__8__unlocked \ 37 | class_selected__curvature__class_places__8__unlocked \ 38 | edge3d__segmentsemantic_rb__class_places__8__unlocked \ 39 | edge3d__curvature__class_places__8__unlocked \ 40 | segmentsemantic_rb__curvature__class_places__8__unlocked \ 41 | -------------------------------------------------------------------------------- /code/tools/config_list_places_third_order.txt: -------------------------------------------------------------------------------- 1 | class_1000__class_selected,edge3d__class_places__8__unlocked \ 2 | class_1000__class_selected,segmentsemantic_rb__class_places__8__unlocked \ 3 | class_1000__class_selected,curvature__class_places__8__unlocked \ 4 | class_1000__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 5 | class_1000__edge3d,curvature__class_places__8__unlocked \ 6 | class_1000__segmentsemantic_rb,curvature__class_places__8__unlocked \ 7 | class_selected__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 8 | class_selected__edge3d,curvature__class_places__8__unlocked \ 9 | class_selected__segmentsemantic_rb,curvature__class_places__8__unlocked \ 10 | edge3d__segmentsemantic_rb,curvature__class_places__8__unlocked \ 11 | class_1000__class_selected,edge3d__class_places__8__unlocked \ 12 | class_1000__class_selected,segmentsemantic_rb__class_places__8__unlocked \ 13 | class_1000__class_selected,curvature__class_places__8__unlocked \ 14 | class_1000__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 15 | class_1000__edge3d,curvature__class_places__8__unlocked \ 16 | class_1000__segmentsemantic_rb,curvature__class_places__8__unlocked \ 17 | class_selected__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 18 | class_selected__edge3d,curvature__class_places__8__unlocked \ 19 | class_selected__segmentsemantic_rb,curvature__class_places__8__unlocked \ 20 | edge3d__segmentsemantic_rb,curvature__class_places__8__unlocked \ 21 | class_1000__class_selected,edge3d__class_places__8__unlocked \ 22 | class_1000__class_selected,segmentsemantic_rb__class_places__8__unlocked \ 23 | class_1000__class_selected,curvature__class_places__8__unlocked \ 24 | class_1000__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 25 | class_1000__edge3d,curvature__class_places__8__unlocked \ 26 | class_1000__segmentsemantic_rb,curvature__class_places__8__unlocked \ 27 | class_selected__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 28 | class_selected__edge3d,curvature__class_places__8__unlocked \ 29 | class_selected__segmentsemantic_rb,curvature__class_places__8__unlocked \ 30 | edge3d__segmentsemantic_rb,curvature__class_places__8__unlocked \ 31 | class_1000__class_selected,edge3d__class_places__8__unlocked \ 32 | class_1000__class_selected,segmentsemantic_rb__class_places__8__unlocked \ 33 | class_1000__class_selected,curvature__class_places__8__unlocked \ 34 | class_1000__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 35 | class_1000__edge3d,curvature__class_places__8__unlocked \ 36 | class_1000__segmentsemantic_rb,curvature__class_places__8__unlocked \ 37 | class_selected__edge3d,segmentsemantic_rb__class_places__8__unlocked \ 38 | class_selected__edge3d,curvature__class_places__8__unlocked \ 39 | class_selected__segmentsemantic_rb,curvature__class_places__8__unlocked \ 40 | edge3d__segmentsemantic_rb,curvature__class_places__8__unlocked \ 41 | -------------------------------------------------------------------------------- /code/tools/final_first_order_rank.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/tools/final_first_order_rank.pkl -------------------------------------------------------------------------------- /code/tools/gen_checkpoint.py: -------------------------------------------------------------------------------- 1 | ckpt_string = 'model_checkpoint_path: "/home/ubuntu/s3/model_log_final/{task}/logs/slim-train/time/model.ckpt-{step}"\nall_model_checkpoint_paths: "/home/ubuntu/s3/model_log_final/{task}/logs/slim-train/time/model.ckpt-{step}"' 2 | with open("checkpoint", "w") as text_file: 3 | print(ckpt_string.format(task="keypoint3d", step="112830"), file=text_file) 4 | -------------------------------------------------------------------------------- /code/tools/generalization.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/tools/generalization.pkl -------------------------------------------------------------------------------- /code/tools/init_paths.py: -------------------------------------------------------------------------------- 1 | import os.path as osp 2 | import sys 3 | 4 | cur_dir = osp.dirname( __file__ ) 5 | # Search lib first 6 | lib_path = osp.join( cur_dir, '..', 'lib' ) 7 | sys.path.insert( 0, lib_path ) 8 | 9 | # Then elsewhere 10 | root_path = osp.join( cur_dir, '..' ) 11 | sys.path.insert( 1, root_path ) -------------------------------------------------------------------------------- /code/tools/order.txt: -------------------------------------------------------------------------------- 1 | denoise_0 2 | vanishing_point_2 3 | non_fixated_pose_2 4 | autoencoder_2 5 | curvature_3 6 | vanishing_point_3 7 | edge2d_2 8 | room_layout_1 9 | impainting_1 10 | rgb2sfnorm_0 11 | fixated_pose_1 12 | denoise_1 13 | keypoint3d_2 14 | keypoint2d_2 15 | curvature_0 16 | rgb2sfnorm_3 17 | colorization_3 18 | rgb2mist_3 19 | rgb2sfnorm_1 20 | keypoint2d_1 21 | jigsaw_0 22 | point_match_1 23 | edge2d_0 24 | colorization_1 25 | reshade_0 26 | rgb2depth_0 27 | segment25d_3 28 | impainting_2 29 | autoencoder_1 30 | jigsaw_3 31 | edge3d_0 32 | rgb2depth_1 33 | autoencoder_0 34 | colorization_2 35 | denoise_2 36 | ego_motion_0 37 | rgb2mist_1 38 | autoencoder_3 39 | keypoint2d_3 40 | vanishing_point_1 41 | rgb2sfnorm_2 42 | edge2d_1 43 | jigsaw_2 44 | room_layout_3 45 | ego_motion_1 46 | segment2d_3 47 | curvature_1 48 | edge3d_1 49 | segment2d_1 50 | keypoint3d_0 51 | segment2d_0 52 | curvature_2 53 | ego_motion_3 54 | segment25d_2 55 | rgb2depth_2 56 | keypoint3d_3 57 | denoise_3 58 | room_layout_0 59 | ego_motion_2 60 | non_fixated_pose_0 61 | keypoint3d_1 62 | reshade_1 63 | rgb2depth_3 64 | fixated_pose_3 65 | impainting_0 66 | fixated_pose_0 67 | jigsaw_1 68 | edge2d_3 69 | non_fixated_pose_3 70 | room_layout_2 71 | reshade_3 72 | edge3d_2 73 | edge3d_3 74 | colorization_0 75 | fixated_pose_2 76 | rgb2mist_0 77 | segment2d_2 78 | rgb2mist_2 79 | point_match_0 80 | point_match_2 81 | point_match_3 82 | non_fixated_pose_1 83 | impainting_3 84 | segment25d_1 85 | vanishing_point_0 86 | segment25d_0 87 | keypoint2d_0 88 | reshade_2 89 | -------------------------------------------------------------------------------- /code/tools/prepare_instance.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import os 3 | def download_task_model(task): 4 | m_path = os.path.join('/home/ubuntu/s3', "model_log_final", task, 5 | "logs/model.permanent-ckpt") 6 | dirs, fname = os.path.split(m_path) 7 | dst_dir = dirs.replace('/home/ubuntu/s3', "s3://taskonomy-unpacked-oregon") 8 | tmp_path = "/home/ubuntu/temp/{}".format(task) 9 | subprocess.call('mkdir -p {}'.format(tmp_path), shell=True) 10 | tmp_fname = os.path.join(tmp_path, fname) 11 | aws_cp_command = "aws s3 cp {}.data-00000-of-00001 {}".format(os.path.join(dst_dir, fname), tmp_path) 12 | subprocess.call(aws_cp_command, shell=True) 13 | aws_cp_command = "aws s3 cp {}.meta {}".format(os.path.join(dst_dir, fname), tmp_path) 14 | subprocess.call(aws_cp_command, shell=True) 15 | aws_cp_command = "aws s3 cp {}.index {}".format(os.path.join(dst_dir, fname), tmp_path) 16 | subprocess.call(aws_cp_command, shell=True) 17 | 18 | list_of_tasks = 'autoencoder curvature denoise edge2d edge3d \ 19 | keypoint2d keypoint3d colorization jigsaw \ 20 | reshade rgb2depth rgb2mist rgb2sfnorm \ 21 | room_layout segment25d segment2d vanishing_point_well_defined \ 22 | segmentsemantic_rb class_1000 class_places impainting_whole' 23 | list_of_tasks = 'impainting_whole' 24 | list_of_tasks = list_of_tasks.split() 25 | for t in list_of_tasks: 26 | download_task_model(t) 27 | -------------------------------------------------------------------------------- /code/tools/ranked_first_order_transfers.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/tools/ranked_first_order_transfers.pkl -------------------------------------------------------------------------------- /code/tools/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | source /home/ubuntu/.bashrc 3 | dirname="temp" 4 | mkdir -p -- "$dirname" 5 | 6 | task_name="" 7 | config_num="" 8 | moment=$(date +"%m%d_%T") 9 | #log_file="train_log_$moment.txt" 10 | log_file="train_log.txt" 11 | resume="" 12 | 13 | function usage 14 | { 15 | echo "-t or --task for task_name; -i or --config for config_num; -l or --log for log_file" 16 | } 17 | 18 | while [ "$1" != "" ] 19 | do 20 | case "$1" in 21 | -t | --task ) shift 22 | task_name=$1 23 | ;; 24 | -i | --config ) shift 25 | config_num="config_$1/" 26 | ;; 27 | -l | --log ) shift 28 | log_file=$1 29 | ;; 30 | -r | --resume) shift 31 | resume=1 32 | ;; 33 | -h | --help ) usage 34 | exit 35 | ;; 36 | * ) usage 37 | exit 1 38 | esac 39 | shift 40 | done 41 | 42 | echo "Running Experiment for Task: $task_name" 43 | echo "Using config: $config_num" 44 | echo "Logging to $log_file" 45 | 46 | if [ "$task_name" = "" ]; then 47 | echo "Task Name is empty..." 48 | exit 1 49 | fi 50 | 51 | config_root="experiments/final" 52 | 53 | root_dir="/home/ubuntu/task-taxonomy-331b" 54 | aws_dir="/home/ubuntu/s3/model_log/$task_name" 55 | BUCKET="task-preprocessing-512-oregon/model_log_new" 56 | 57 | #if /usr/bin/aws s3 ls "s3://$BUCKET/" | grep $task_name ; then 58 | #if ["$resume" = ""]; then 59 | #echo "Task Dir, $aws_dir already exists on S3, to resume training, use flag -r, --resume 1" 60 | #exit 1 61 | #fi 62 | #fi 63 | 64 | #echo $(mkdir -p -- "$aws_dir") 65 | #touch "$aws_dir/CREATE" 66 | 67 | task_name=$config_root/$task_name 68 | 69 | echo "$(env)" > /home/ubuntu/temp/START_ENV 70 | 71 | echo "python -u $root_dir/tools/train.py $root_dir/$task_name/$config_num 2>&1 | tee $root_dir/$task_name/$config_num$log_file" > /home/ubuntu/temp/PY_COMMAND 72 | echo "$root_dir/$task_name/$config_num$log_file" > /home/ubuntu/temp/LOG_FILE 73 | #touch $root_dir/$task_name/$config_num$log_file 74 | /home/ubuntu/anaconda3/bin/python -u $root_dir/tools/train.py $root_dir/$task_name/$config_num 2>&1 | tee $root_dir/$task_name/$config_num$log_file 75 | 76 | #python -u train.py $root_dir/$task_name/$config_num 2>&1 | tee $aws_dir/$task_name/$config_num$log_file 77 | -------------------------------------------------------------------------------- /code/tools/run_from_task_pool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | resume="" 3 | 4 | function usage 5 | { 6 | echo "--resume, -r for resuming action" 7 | } 8 | 9 | while [ "$1" != "" ] 10 | do 11 | case "$1" in 12 | -r | --resume) shift 13 | resume=1 14 | ;; 15 | -h | --help ) usage 16 | exit 17 | ;; 18 | * ) usage 19 | exit 1 20 | esac 21 | shift 22 | done 23 | instance_id=$(/usr/bin/ec2metadata --instance-id) 24 | 25 | #ec2addtag $instance_id --region "us-west-2" --aws-access-key $(echo $AWS_ACCESS_KEY_ID) --aws-secret-key $(echo $AWS_SECRET_ACCESS_KEY) --tag Name="$new_tag_name" 26 | 27 | cat /home/ubuntu/task-taxonomy-331b/tools/task_list.txt | shuf > order.txt 28 | 29 | IFS=$'\r\n' GLOBIGNORE='*' command eval 'TASKS=($(cat order.txt))' 30 | #printf '%s\n' "${TASKS[@]}" 31 | BUCKET="task-preprocessing-512/model_log" 32 | 33 | #declare -a TASKS=("curvature_0") 34 | 35 | for i in "${TASKS[@]}" 36 | do 37 | DIR="" 38 | if ["$resume" = ""]; then 39 | DIR="s3://$BUCKET/" 40 | str="$i" 41 | else 42 | DIR="s3://$BUCKET/$i/" 43 | str="RESUME" 44 | fi 45 | echo "/usr/bin/aws s3 ls $DIR | grep "$str" " 46 | 47 | if /usr/bin/aws s3 ls $DIR | grep "$str" ; then 48 | echo "DIRECTORY of $i EXISTS, task already been training, run resume.sh if want to resume" 49 | else 50 | echo "RUNNING EXPERIMENT: $i" 51 | /usr/bin/ec2addtag $instance_id --region "us-west-2" --aws-access-key $(echo $AWS_ACCESS_KEY_ID) --aws-secret-key $(echo $AWS_SECRET_ACCESS_KEY) --tag Name="$i" 52 | 53 | touch "/home/ubuntu/s3/model_log/$i/RESUME" 54 | 55 | echo "/usr/bin/ec2addtag $instance_id --region us-west-2 --aws-access-key $(echo $AWS_ACCESS_KEY_ID) --aws-secret-key $(echo $AWS_SECRET_ACCESS_KEY) --tag Name=$i" > /home/ubuntu/START_RUN 56 | if ["$resume" = ""]; then 57 | /home/ubuntu/task-taxonomy-331b/tools/run.sh -t $i 58 | else 59 | /home/ubuntu/task-taxonomy-331b/tools/run.sh -t $i --resume 60 | fi 61 | /usr/bin/ec2addtag $instance_id --region "us-west-2" --aws-access-key $(echo $AWS_ACCESS_KEY_ID) --aws-secret-key $(echo $AWS_SECRET_ACCESS_KEY) --tag Name="DONE_$i" 62 | exit 0 63 | #mkdir /home/ubuntu/s3/model_log/$i 64 | fi 65 | done 66 | 67 | /usr/bin/ec2addtag $instance_id --region "us-west-2" --aws-access-key $(echo $AWS_ACCESS_KEY_ID) --aws-secret-key $(echo $AWS_SECRET_ACCESS_KEY) --tag Name="NOT RUNNING" 68 | 69 | 70 | -------------------------------------------------------------------------------- /code/tools/run_viz_notebooks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | declare -a ARCHS=("dilated_l1l2" "dilated_l1l4""dilated_l1l8" "dilated_l3l8" "dilated_l6l2" "dilated_l6l4" "dilated_l6l8" ) 3 | for t in "${ARCHS[@]}" 4 | do 5 | python /home/ubuntu/task-taxonomy-331b/tools/run_viz_notebooks_single.py --idx -1 --hs 8 --arch $t 2>&1 | tee $t.txt 6 | done 7 | # python /home/ubuntu/task-taxonomy-331b/tools/run_viz_notebooks.py --idx -1 --hs 256 8 | # python /home/ubuntu/task-taxonomy-331b/tools/run_viz_notebooks.py --idx -1 --hs 1024 9 | #git add . 10 | git commit -m 'updated viz notebooks' 11 | #git push autopull perceptual-transfer 12 | -------------------------------------------------------------------------------- /code/tools/script/aws_2.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | for number in {1..20} 4 | do 5 | echo "Welcome to spot fleet, No.$number... " 6 | aws ec2 request-spot-instances --spot-price "0.40" --instance-count 1 --launch-specification file://launch_specs_2.json 7 | sleep 30 8 | done 9 | -------------------------------------------------------------------------------- /code/tools/script/change_epochs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat task_list.txt | shuf > order.txt 4 | 5 | IFS=$'\r\n' GLOBIGNORE='*' command eval 'TASKS=($(cat order.txt))' 6 | 7 | prefix="cfg.'num.epochs'..=.3" 8 | sub_tring="cfg['num_epochs'] = 12" 9 | echo $prefix 10 | 11 | root="/home/ubuntu/task-taxonomy-331b/experiments/aws_batch" 12 | for i in "${TASKS[@]}" 13 | do 14 | for j in 0 1 2 3 15 | do 16 | dir_name="$root/$i" 17 | 18 | config_file="$dir_name/config.py" 19 | echo "processing $config_file" 20 | vim -c ":%s/$prefix/$sub_string/g" -c "wq" $config_file 21 | done 22 | done 23 | 24 | 25 | -------------------------------------------------------------------------------- /code/tools/script/combine_representation_files.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pickle as pkl 3 | 4 | src = '/home/ubuntu/task-taxonomy-331b/assets/aws_data/train_image_split_0.npy' 5 | dst = '/home/ubuntu/task-taxonomy-331b/assets/aws_data/train_point_match_0.npy' 6 | 7 | with open(src, 'rb') as f: 8 | src_files = np.load(src) 9 | 10 | with open(dst, 'rb') as f: 11 | dst_files = np.load(dst) 12 | 13 | 14 | def parse_filename( filename ): 15 | filename = filename.decode("utf-8") 16 | model, points, views = filename.split("/") 17 | points = points.split(",") 18 | views = views.split(",") 19 | return model, points, views 20 | 21 | def get_first_file(joined): 22 | model, points, views = parse_filename(joined) 23 | return model, points[-1], views[-1] 24 | 25 | 26 | src_file_to_idx = { get_first_file(joined): i 27 | for i, joined in enumerate(src_files) } 28 | 29 | 30 | dst_file_to_src_idx 31 | print(dst_files.shape) 32 | 33 | 34 | idx = 0 35 | print("File index for {}: {}".format( 36 | get_first_file(src_files[idx]), 37 | idx)) 38 | 39 | print(get_first_file( src_files[idx] ), 40 | src_file_to_idx[ get_first_file( src_files[idx] ) ] 41 | ) -------------------------------------------------------------------------------- /code/tools/script/cp_single_model.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Name: cp_transfer_model.py 3 | Desc: Copy current model to dir. 4 | Usage: 5 | python cp_transfer_model.py 6 | ''' 7 | from __future__ import absolute_import, division, print_function 8 | 9 | import os 10 | import tensorflow as tf 11 | import concurrent.futures 12 | 13 | MAX_CONCURRENT=10 14 | def main( _ ): 15 | # root_dir = '/home/ubuntu/s3/model_log_new/nonfix_new_bn' 16 | # root_dir = '/home/ubuntu/s3/model_log/transfer' 17 | # root_dir = '/home/ubuntu/s3/model_log/transfer_transitive' 18 | root_dir = '/home/ubuntu/s3/model_log_final/' 19 | log_dir = 'logs/slim-train/' 20 | 21 | list_of_task = ['vanishing_point_well_defined'] 22 | # '3d_to_denoise__1024', 23 | # '2d_to_denoise__1024'] 24 | # list_of_task = os.listdir(root_dir) 25 | # list_of_task = 'reshade__denoise__1024 reshade__edge3d__1024 reshade__edge2d__1024'.split(" ") 26 | # print(list_of_task) 27 | task_step_list = [] 28 | for task in list_of_task: 29 | # if 'pixels' not in task: 30 | # continue 31 | # if 'autoencoder' not in task: 32 | # continue 33 | ckpt_dir = os.path.join( root_dir, task, log_dir ) 34 | full_path = tf.train.latest_checkpoint(ckpt_dir) 35 | print(ckpt_dir) 36 | if full_path is None: 37 | print('Checkpoint not found for {}'.format(task)) 38 | # continue 39 | task = '/home/ubuntu/s3/model_log_final/{}/'.format(task) 40 | step = 38400 41 | else: 42 | step = full_path.split('-')[-1] 43 | task_step_list.append( (task, step) ) 44 | 45 | #print(task_step_list) 46 | start_model_copy_threads( task_step_list, root_dir, log_dir ) 47 | 48 | 49 | def start_model_copy_threads( task_step_list, root_dir, log_dir ): 50 | from functools import partial 51 | 52 | mapfunc = partial(cp_task, root_dir=root_dir, log_dir=log_dir ) 53 | iter_task_step_list = iter(task_step_list) 54 | #with concurrent.futures.ThreadPoolExecutor(max_workers=len(task_step_list)) as executor: 55 | with concurrent.futures.ThreadPoolExecutor(max_workers=15) as executor: 56 | result = executor.map(mapfunc, iter_task_step_list) 57 | #concurrent.futures.wait(result) 58 | 59 | def cp_task( task_step_pair, root_dir='', log_dir=''): 60 | task, step = task_step_pair 61 | model_cp_from = 'model.permanent-ckpt-{step}.{{suffix}}'.format(step=step) 62 | complete_from = os.path.join( root_dir, task, log_dir, model_cp_from ) 63 | model_cp_to = 'model.permanent-ckpt.{suffix}' 64 | complete_to = os.path.join( root_dir, task, model_cp_to ) 65 | 66 | suffix_list = ['data-00000-of-00001', 'index', 'meta'] 67 | 68 | for suffix in suffix_list: 69 | cp_from = complete_from.format(suffix=suffix) 70 | cp_to = complete_to.format(suffix=suffix) 71 | command = "sudo cp {cp_from} {cp_to}".format(cp_from=cp_from, cp_to=cp_to) 72 | #print(command) 73 | os.system(command) 74 | print('{task} has finished'.format(task=task)) 75 | 76 | 77 | 78 | 79 | if __name__=='__main__': 80 | main( '' ) 81 | -------------------------------------------------------------------------------- /code/tools/script/cp_transfer_model.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Name: cp_transfer_model.py 3 | Desc: Copy current model to dir. 4 | Usage: 5 | python cp_transfer_model.py 6 | ''' 7 | from __future__ import absolute_import, division, print_function 8 | 9 | import os 10 | import tensorflow as tf 11 | import concurrent.futures 12 | 13 | MAX_CONCURRENT=10 14 | def main( _ ): 15 | # root_dir = '/home/ubuntu/s3/model_log_new/nonfix_new_bn' 16 | # root_dir = '/home/ubuntu/s3/model_log/transfer' 17 | root_dir = '/home/ubuntu/s3/experiment_models/transfer_8' 18 | # root_dir = '/home/ubuntu/s3/model_log_final/' 19 | log_dir = 'logs/slim-train' 20 | 21 | list_of_task = ['vanishing_point_well_defined'] 22 | # '3d_to_denoise__1024', 23 | # '2d_to_denoise__1024'] 24 | # list_of_task = os.listdir(root_dir) 25 | # list_of_task = 'reshade__denoise__1024 reshade__edge3d__1024 reshade__edge2d__1024'.split(" ") 26 | # print(list_of_task) 27 | task_step_list = [] 28 | src_tasks = os.listdir(root_dir) 29 | for src in src_tasks: 30 | target_tasks = os.listdir(root_dir) 31 | for target in target_tasks: 32 | # if 'pixels' not in task: 33 | # continue 34 | # if 'autoencoder' not in task: 35 | # continue 36 | ckpt_dir = os.path.join( root_dir, src, target, log_dir ) 37 | full_path = tf.train.latest_checkpoint(ckpt_dir) 38 | print(ckpt_dir) 39 | if full_path is None: 40 | print('Checkpoint not found for {}'.format(src, target)) 41 | continue 42 | # task = '/home/ubuntu/s3/model_log_final/{}/'.format(task) 43 | # step = 4042 44 | else: 45 | step = full_path.split('-')[-1] 46 | task_step_list.append( (os.path.join(src, target), step) ) 47 | 48 | #print(task_step_list) 49 | start_model_copy_threads( task_step_list, root_dir, log_dir ) 50 | 51 | 52 | def start_model_copy_threads( task_step_list, root_dir, log_dir ): 53 | from functools import partial 54 | 55 | mapfunc = partial(cp_task, root_dir=root_dir, log_dir=log_dir ) 56 | iter_task_step_list = iter(task_step_list) 57 | #with concurrent.futures.ThreadPoolExecutor(max_workers=len(task_step_list)) as executor: 58 | with concurrent.futures.ThreadPoolExecutor(max_workers=15) as executor: 59 | result = executor.map(mapfunc, iter_task_step_list) 60 | #concurrent.futures.wait(result) 61 | 62 | def cp_task( task_step_pair, root_dir='', log_dir=''): 63 | task, step = task_step_pair 64 | model_cp_from = 'model.permanent-ckpt-{step}.{{suffix}}'.format(step=step) 65 | complete_from = os.path.join( root_dir, task, log_dir, model_cp_from ) 66 | model_cp_to = 'model.permanent-ckpt.{suffix}' 67 | complete_to = os.path.join( root_dir, task, model_cp_to ) 68 | 69 | suffix_list = ['data-00000-of-00001', 'index', 'meta'] 70 | 71 | for suffix in suffix_list: 72 | cp_from = complete_from.format(suffix=suffix) 73 | cp_to = complete_to.format(suffix=suffix) 74 | command = "sudo cp {cp_from} {cp_to}".format(cp_from=cp_from, cp_to=cp_to) 75 | # print(command) 76 | os.system(command) 77 | print('{task} has finished'.format(task=task)) 78 | 79 | 80 | 81 | 82 | if __name__=='__main__': 83 | main( '' ) 84 | -------------------------------------------------------------------------------- /code/tools/script/create_hyperparam_sweep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cat task_list.txt | shuf > order.txt 4 | 5 | IFS=$'\r\n' GLOBIGNORE='*' command eval 'TASKS=($(cat order.txt))' 6 | 7 | declare -a lr=( "1e-5" "1e-6" "1e-4" "1e-3" ) 8 | 9 | prefix="cfg['initial_learning_rate'] = " 10 | echo $prefix 11 | 12 | root="/home/ubuntu/task-taxonomy-331b/experiments/aws_batch" 13 | for i in "${TASKS[@]}" 14 | do 15 | for j in 0 1 2 3 16 | do 17 | src_dir="$root/$i" 18 | dir_name="$root/$i*$j" 19 | echo "cp -r $src_dir $dir_name" 20 | #cp -r $src_dir $dir_name 21 | 22 | lr_insert="$prefix${lr[j]}" 23 | 24 | config_file="$dir_name/config.py" 25 | #vim -c ":%s/1e-6, 1e-1/&\r $lr_insert/g" -c "wq" $config_file 26 | done 27 | done 28 | 29 | for i in "${TASKS[@]}" 30 | do 31 | dir="$root/$i" 32 | rm -r $dir 33 | done 34 | 35 | -------------------------------------------------------------------------------- /code/tools/script/generate_samples_for_transitivity.py: -------------------------------------------------------------------------------- 1 | """ 2 | Sample triplets for extraction: 3 | e.g. 4 | python generate_samples_for_transitivity.py \ 5 | > /home/ubuntu/task-taxonomy-331b/assets/transitivity/selected_samples.txt 6 | 7 | cut -d ' ' -f -2 /home/ubuntu/task-taxonomy-331b/assets/transitivity/selected_samples.txt \ 8 | | uniq > /home/ubuntu/task-taxonomy-331b/assets/transitivity/first_transfer.txt 9 | 10 | cut -d ' ' -f 2- /home/ubuntu/task-taxonomy-331b/assets/transitivity/selected_samples.txt \ 11 | | uniq > /home/ubuntu/task-taxonomy-331b/assets/transitivity/second_transfer.txt 12 | 13 | """ 14 | from __future__ import print_function 15 | import random 16 | import copy 17 | 18 | TASKS="autoencoder denoise edge2d edge3d impainting keypoint2d keypoint3d reshade rgb2depth rgb2sfnorm".split(" ") 19 | 20 | selected = [] 21 | 22 | for intermediate in TASKS: 23 | valid = list(set(TASKS) - set([intermediate])) 24 | random.shuffle(valid) 25 | srcs = valid[:3] 26 | dsts = list(set(valid) - set(srcs))[:3] 27 | random.shuffle(dsts) 28 | for src in srcs: 29 | for dst in dsts: 30 | print(src, intermediate, dst) 31 | selected.append((src, intermediate, dst)) 32 | -------------------------------------------------------------------------------- /code/tools/script/launch_imagenet_finetune.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-a7fa31df" #extract 14 | INSTANCE_TYPE="g3.4xlarge" 15 | # INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( a b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=50 27 | 28 | # Intermediate tasks left out 29 | # ego_motion 30 | # INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 31 | # fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 32 | # non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 33 | # room_layout segment25d segment2d vanishing_point_well_defined pixels random \ 34 | # segmentsemantic_rb class_selected class_1000" 35 | 36 | # INTERMEDIATE_TASKS="ego_motion" 37 | 38 | 39 | 40 | INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 41 | fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 42 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 43 | room_layout segment25d segment2d vanishing_point_well_defined \ 44 | segmentsemantic_rb class_selected class_1000" 45 | INTERMEDIATE_TASKS="reshade colorization ego_motion class_places" 46 | # DST tasks left out 47 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 48 | 49 | 50 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 51 | COUNTER=0 52 | #for src in $SRC_TASKS; do 53 | for intermediate in $INTERMEDIATE_TASKS; do 54 | sleep 2 55 | COUNTER=$[$COUNTER +1] 56 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 57 | if [ "$COUNTER" -lt "$START_AT" ]; then 58 | echo "Skipping at $COUNTER (starting at $START_AT)" 59 | continue 60 | fi 61 | echo "running $COUNTER" 62 | 63 | if [[ "$platform" == "linux" ]]; 64 | then 65 | OPTIONS="-w 0" 66 | ECHO_OPTIONS="-d" 67 | else 68 | OPTIONS="" 69 | ECHO_OPTIONS="-D" 70 | fi 71 | 72 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 73 | export INSTANCE_TAG="${intermediate}"; 74 | # export INSTANCE_TAG="SASHA P2 WORK INSTANCE"; 75 | export HOME="/home/ubuntu" 76 | # export ACTION=SHUTDOWN; 77 | export ACTION=FINETUNE_IMAGENET_SELECTED; 78 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 79 | 80 | cd /home/ubuntu/task-taxonomy-331b 81 | git stash 82 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 83 | git pull autopull perceptual-transfer 84 | git pull autopull perceptual-transfer 85 | 86 | # bash /home/ubuntu/task-taxonomy-331b/tools/script/generate_all_transfer_configs.sh 87 | # python /home/ubuntu/task-taxonomy-331b/tools/transfer.py \ 88 | # /home/ubuntu/task-taxonomy-331b/experiments/full_taskonomy_beta1/${decode}/${data}/${intermediate}__${dst}__8__unlocked/ 89 | 90 | END_USER_DATA 91 | ) 92 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 93 | 94 | aws ec2 request-spot-instances \ 95 | --spot-price $SPOT_PRICE \ 96 | --instance-count $INSTANCE_COUNT \ 97 | --region $ZONE \ 98 | --launch-specification \ 99 | "{ \ 100 | \"ImageId\":\"$AMI\", \ 101 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 102 | \"KeyName\":\"$KEY_NAME\", \ 103 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 104 | \"UserData\":\"$USER_DATA\", \ 105 | \"Placement\": { \ 106 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 107 | } \ 108 | }" 109 | 110 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 111 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 112 | break 113 | fi 114 | done 115 | 116 | 117 | -------------------------------------------------------------------------------- /code/tools/script/launch_imagenet_rep_extract.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-6819d110" #extract 14 | INSTANCE_TYPE="p2.xlarge" 15 | # INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( a b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=50 27 | 28 | # Intermediate tasks left out 29 | # ego_motion 30 | # INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 31 | # fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 32 | # non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 33 | # room_layout segment25d segment2d vanishing_point_well_defined pixels random \ 34 | # segmentsemantic_rb class_selected class_1000" 35 | 36 | # INTERMEDIATE_TASKS="ego_motion" 37 | 38 | 39 | 40 | INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 41 | ego_motion fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 42 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 43 | room_layout segment25d segment2d vanishing_point_well_defined \ 44 | segmentsemantic_rb class_selected class_1000" 45 | 46 | # DST tasks left out 47 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 48 | 49 | 50 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 51 | COUNTER=0 52 | #for src in $SRC_TASKS; do 53 | for intermediate in $INTERMEDIATE_TASKS; do 54 | sleep 2 55 | COUNTER=$[$COUNTER +1] 56 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 57 | if [ "$COUNTER" -lt "$START_AT" ]; then 58 | echo "Skipping at $COUNTER (starting at $START_AT)" 59 | continue 60 | fi 61 | echo "running $COUNTER" 62 | 63 | if [[ "$platform" == "linux" ]]; 64 | then 65 | OPTIONS="-w 0" 66 | ECHO_OPTIONS="-d" 67 | else 68 | OPTIONS="" 69 | ECHO_OPTIONS="-D" 70 | fi 71 | 72 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 73 | export INSTANCE_TAG="${intermediate}"; 74 | # export INSTANCE_TAG="SASHA P2 WORK INSTANCE"; 75 | export HOME="/home/ubuntu" 76 | # export ACTION=SHUTDOWN; 77 | export ACTION=EXTRACT_REPS_IMAGENET; 78 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 79 | 80 | cd /home/ubuntu/task-taxonomy-331b 81 | git stash 82 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 83 | git pull autopull perceptual-transfer 84 | git pull autopull perceptual-transfer 85 | 86 | # bash /home/ubuntu/task-taxonomy-331b/tools/script/generate_all_transfer_configs.sh 87 | # python /home/ubuntu/task-taxonomy-331b/tools/transfer.py \ 88 | # /home/ubuntu/task-taxonomy-331b/experiments/full_taskonomy_beta1/${decode}/${data}/${intermediate}__${dst}__8__unlocked/ 89 | 90 | END_USER_DATA 91 | ) 92 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 93 | 94 | aws ec2 request-spot-instances \ 95 | --spot-price $SPOT_PRICE \ 96 | --instance-count $INSTANCE_COUNT \ 97 | --region $ZONE \ 98 | --launch-specification \ 99 | "{ \ 100 | \"ImageId\":\"$AMI\", \ 101 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 102 | \"KeyName\":\"$KEY_NAME\", \ 103 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 104 | \"UserData\":\"$USER_DATA\", \ 105 | \"Placement\": { \ 106 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 107 | } \ 108 | }" 109 | 110 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 111 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 112 | break 113 | fi 114 | done 115 | 116 | 117 | -------------------------------------------------------------------------------- /code/tools/script/launch_imgnet_kdistill.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-a577d6dd" #extract 14 | #INSTANCE_TYPE="p2.xlarge" 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( a b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=1000 27 | 28 | COUNTER=0 29 | #for src in $SRC_TASKS; do 30 | for idx in {0..198..2}; do 31 | COUNTER=$[$COUNTER +1] 32 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 33 | if [ "$COUNTER" -lt "$START_AT" ]; then 34 | echo "Skipping at $COUNTER (starting at $START_AT)" 35 | continue 36 | fi 37 | echo "running $COUNTER" 38 | 39 | if [[ "$platform" == "linux" ]]; 40 | then 41 | OPTIONS="-w 0" 42 | ECHO_OPTIONS="-d" 43 | else 44 | OPTIONS="" 45 | ECHO_OPTIONS="-D" 46 | fi 47 | 48 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 49 | export INSTANCE_TAG="${idx}" 50 | export HOME="/home/ubuntu" 51 | export ACTION=IMAGENET_KDISTILL; 52 | 53 | cd /home/ubuntu/task-taxonomy-331b 54 | git stash 55 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 56 | git pull autopull perceptual-transfer 57 | git pull autopull perceptual-transfer 58 | 59 | END_USER_DATA 60 | ) 61 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 62 | 63 | sleep 1 64 | aws ec2 request-spot-instances \ 65 | --spot-price $SPOT_PRICE \ 66 | --instance-count $INSTANCE_COUNT \ 67 | --region $ZONE \ 68 | --launch-specification \ 69 | "{ \ 70 | \"ImageId\":\"$AMI\", \ 71 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 72 | \"KeyName\":\"$KEY_NAME\", \ 73 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 74 | \"UserData\":\"$USER_DATA\", \ 75 | \"Placement\": { \ 76 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 77 | } \ 78 | }" 79 | 80 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 81 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 82 | break 83 | fi 84 | done 85 | 86 | 87 | -------------------------------------------------------------------------------- /code/tools/script/launch_instance.sh: -------------------------------------------------------------------------------- 1 | INSTANCE_TAG="testing round 2" 2 | COMMAND='echo "Success" > /home/ubuntu/testing.log' 3 | 4 | # AMI="ami-660ae31e" 5 | INSTANCE_TYPE="p2.xlarge" 6 | AMI="ami-6a01e812" #extract 7 | # INSTANCE_TYPE="c3.2xlarge" 8 | INSTANCE_COUNT=1 9 | KEY_NAME="taskonomy" 10 | SECURITY_GROUP="launch-wizard-1" 11 | SPOT_PRICE=0.4 12 | ZONE="us-west-2" 13 | 14 | START_AT=1 15 | EXIT_AFTER=1 16 | 17 | # Now generate transfers 18 | # TASKS="autoencoder colorization denoise edge2d edge3d impainting keypoint2d keypoint3d reshade rgb2depth rgb2mist rgb2sfnorm" 19 | # IGNORED: colorization rgb2mist 20 | TASKS="autoencoder denoise edge2d edge3d impainting keypoint2d keypoint3d reshade rgb2depth rgb2sfnorm" 21 | KEPT_TASKS=$TASKS 22 | # "denoise" 23 | 24 | COUNTER=0 25 | for src in $KEPT_TASKS; do 26 | for dst in $KEPT_TASKS; do 27 | COUNTER=$[$COUNTER +1] 28 | if [ "$COUNTER" -lt "$START_AT" ]; then 29 | echo "Skipping at $COUNTER (starting at $START_AT)" 30 | continue 31 | fi 32 | echo "running $COUNTER" 33 | 34 | USER_DATA=$(echo "export INSTANCE_TAG=\"${src}__${dst}__1024 --data-split val\";" | base64) 35 | echo "$USER_DATA" | base64 -d 36 | 37 | 38 | aws ec2 request-spot-instances \ 39 | --spot-price $SPOT_PRICE \ 40 | --instance-count $INSTANCE_COUNT \ 41 | --region $ZONE \ 42 | --launch-specification \ 43 | "{ \ 44 | \"ImageId\":\"$AMI\", \ 45 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 46 | \"KeyName\":\"$KEY_NAME\", \ 47 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 48 | \"UserData\":\"$USER_DATA\" \ 49 | }" 50 | 51 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 52 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 53 | break 54 | fi 55 | 56 | # echo USER_DATA 57 | done 58 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 59 | echo "EXITING after $COUNTER" 60 | break 61 | fi 62 | done 63 | 64 | -------------------------------------------------------------------------------- /code/tools/script/launch_places_first_order.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-0460b47c" #extract 14 | #INSTANCE_TYPE="p2.xlarge" 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( a b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=500 27 | 28 | # Intermediate tasks left out 29 | # ego_motion 30 | # INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 31 | # fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 32 | # non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 33 | # room_layout segment25d segment2d vanishing_point_well_defined pixels random \ 34 | # segmentsemantic_rb class_selected class_1000" 35 | 36 | # INTERMEDIATE_TASKS="ego_motion" 37 | 38 | 39 | 40 | INTERMEDIATE_TASKS="autoencoder curvature denoise edge2d edge3d \ 41 | fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 42 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 43 | room_layout segment25d segment2d vanishing_point_well_defined \ 44 | segmentsemantic_rb class_places class_1000 alex lsm cmu pose5 pose6 poseMatch" 45 | INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 46 | fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 47 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 48 | room_layout segment25d segment2d vanishing_point_well_defined \ 49 | segmentsemantic_rb class_places class_1000 class_selected alex lsm cmu pose5 pose6 poseMatch" 50 | #INTERMEDIATE_TASKS="pixels" 51 | # DST tasks left out 52 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 53 | 54 | 55 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 56 | COUNTER=0 57 | #for src in $SRC_TASKS; do 58 | for intermediate in $INTERMEDIATE_TASKS; do 59 | sleep 1 60 | COUNTER=$[$COUNTER +1] 61 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 62 | if [ "$COUNTER" -lt "$START_AT" ]; then 63 | echo "Skipping at $COUNTER (starting at $START_AT)" 64 | continue 65 | fi 66 | echo "running $COUNTER" 67 | 68 | if [[ "$platform" == "linux" ]]; 69 | then 70 | OPTIONS="-w 0" 71 | ECHO_OPTIONS="-d" 72 | else 73 | OPTIONS="" 74 | ECHO_OPTIONS="-D" 75 | fi 76 | 77 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 78 | #export INSTANCE_TAG="final/${intermediate} --data-split train --places"; 79 | export INSTANCE_TAG="${intermediate} --metric-only --from-scratch --layer 3 --dropout 0.3 --hidden 2048 --data-use 16000" 80 | #export INSTANCE_TAG="${intermediate} --metric-only --train-encoder" 81 | #export INSTANCE_TAG="${intermediate} --from-scratch --train-encoder --transfer-type full_taskonomy_beta1" 82 | #export INSTANCE_TAG="${intermediate}" 83 | # export INSTANCE_TAG="SASHA P2 WORK INSTANCE"; 84 | export HOME="/home/ubuntu" 85 | # export ACTION=SHUTDOWN; 86 | export ACTION=FINETUNE_PLACES; 87 | #export ACTION=EXTRACT_REPS 88 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 89 | 90 | cd /home/ubuntu/task-taxonomy-331b 91 | git stash 92 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 93 | git pull autopull perceptual-transfer 94 | git pull autopull perceptual-transfer 95 | 96 | # bash /home/ubuntu/task-taxonomy-331b/tools/script/generate_all_transfer_configs.sh 97 | # python /home/ubuntu/task-taxonomy-331b/tools/transfer.py \ 98 | # /home/ubuntu/task-taxonomy-331b/experiments/full_taskonomy_beta1/${decode}/${data}/${intermediate}__${dst}__8__unlocked/ 99 | 100 | END_USER_DATA 101 | ) 102 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 103 | 104 | aws ec2 request-spot-instances \ 105 | --spot-price $SPOT_PRICE \ 106 | --instance-count $INSTANCE_COUNT \ 107 | --region $ZONE \ 108 | --launch-specification \ 109 | "{ \ 110 | \"ImageId\":\"$AMI\", \ 111 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 112 | \"KeyName\":\"$KEY_NAME\", \ 113 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 114 | \"UserData\":\"$USER_DATA\", \ 115 | \"Placement\": { \ 116 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 117 | } \ 118 | }" 119 | 120 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 121 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 122 | break 123 | fi 124 | done 125 | 126 | 127 | -------------------------------------------------------------------------------- /code/tools/script/launch_single_tasks.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | # AMI="ami-660ae31e" 10 | INSTANCE_TYPE="p2.xlarge" 11 | AMI="ami-7edd3606" #extract 12 | INSTANCE_COUNT=1 13 | KEY_NAME="taskonomy" 14 | SECURITY_GROUP="launch-wizard-1" 15 | SPOT_PRICE=0.4 16 | ZONE="us-west-2" 17 | 18 | START_AT=1 19 | EXIT_AFTER=1 20 | 21 | # Now generate transfers 22 | TASKS="autoencoder colorization denoise edge2d edge3d impainting keypoint2d keypoint3d reshade rgb2depth rgb2mist rgb2sfnorm colorization vanishing_point" 23 | # IGNORED: colorization rgb2mist 24 | # TASKS="keypoint2d keypoint3d reshade rgb2depth rgb2sfnorm rgb2mist colorization vanishing_point jigsaw" 25 | KEPT_TASKS=$TASKS 26 | # "denoise" 27 | 28 | COUNTER=0 29 | for task in $KEPT_TASKS; do 30 | COUNTER=$[$COUNTER +1] 31 | if [ "$COUNTER" -lt "$START_AT" ]; then 32 | echo "Skipping at $COUNTER (starting at $START_AT)" 33 | continue 34 | fi 35 | 36 | # New version take an --action 37 | # USER_DATA=$(echo -n "export INSTANCE_TAG=\"${src}__${dst}__1024 --data-split train --action EXTRACT_LOSSES\";" | base64 -w 0) 38 | # export INSTANCE_TAG="${src}__${dst}__1024 --data-split train"; 39 | 40 | if [[ "$platform" == "linux" ]]; 41 | then 42 | OPTIONS="-w 0" 43 | ECHO_OPTIONS="-d" 44 | else 45 | OPTIONS="" 46 | ECHO_OPTIONS="-D" 47 | fi 48 | 49 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 50 | export INSTANCE_TAG="${task} --data-split test"; 51 | export ACTION=SHUTDOWN; 52 | cd /home/ubuntu/task-taxonomy-331b 53 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 54 | git pull autopull perceptual-transfer 55 | python /home/ubuntu/task-taxonomy-331b/tools/extract_losses.py --cfg_dir /home/ubuntu/task-taxonomy-331b/experiments/aws_second/ --task $task --data-split test 56 | END_USER_DATA 57 | ) 58 | echo "$USER_DATA" | base64 -D 59 | 60 | aws ec2 request-spot-instances \ 61 | --spot-price $SPOT_PRICE \ 62 | --instance-count $INSTANCE_COUNT \ 63 | --region $ZONE \ 64 | --launch-specification \ 65 | "{ \ 66 | \"ImageId\":\"$AMI\", \ 67 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 68 | \"KeyName\":\"$KEY_NAME\", \ 69 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 70 | \"UserData\":\"$USER_DATA\" \ 71 | }" 72 | 73 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 74 | echo "EXITING after $COUNTER" 75 | break 76 | fi 77 | done 78 | 79 | -------------------------------------------------------------------------------- /code/tools/script/launch_task_gen_rep_extract.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-d21ab9aa" #extract 14 | #AMI="ami-7428ff0c" #extract 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="p2.xlarge" 17 | # INSTANCE_TYPE="p3.2xlarge" 18 | #INSTANCE_TYPE="c4.4xlarge" 19 | INSTANCE_COUNT=1 20 | KEY_NAME="taskonomy" 21 | SECURITY_GROUP="launch-wizard-1" 22 | SPOT_PRICE=1.001 23 | ZONE="us-west-2" 24 | SUB_ZONES=( a b c ) 25 | 26 | # 11 - X 27 | START_AT=1 28 | EXIT_AFTER=900 29 | DATA_USED="16k" 30 | 31 | #echo 'sleeping for 4 hrs...' 32 | #sleep 4h 33 | #INTERMEDIATE_TASKS="denoise__impainting_whole__autoencoder__8__unlocked" 34 | INTERMEDIATE_TASKS="curvature_2 denoise_2 rgb2sfnorm_2 \ 35 | class_places_2 room_layout_2" 36 | INTERMEDIATE_TASKS="rgb2depth_2 vanishing_point_well_defined_2" 37 | 38 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 39 | COUNTER=0 40 | #for src in $SRC_TASKS; do 41 | for intermediate in $INTERMEDIATE_TASKS; do 42 | for decode in $TARGET_DECODER_FUNCS; do 43 | 44 | COUNTER=$[$COUNTER +1] 45 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 46 | if [ "$COUNTER" -lt "$START_AT" ]; then 47 | echo "Skipping at $COUNTER (starting at $START_AT)" 48 | continue 49 | fi 50 | echo "running $COUNTER" 51 | 52 | 53 | if [[ "$platform" == "linux" ]]; 54 | then 55 | OPTIONS="-w 0" 56 | ECHO_OPTIONS="-d" 57 | else 58 | OPTIONS="" 59 | ECHO_OPTIONS="-D" 60 | fi 61 | 62 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 63 | export HOME="/home/ubuntu" 64 | 65 | export INSTANCE_TAG="final/${intermediate} --generalize --data-split test"; 66 | export ACTION=EXTRACT_REPS; 67 | 68 | cd /home/ubuntu/task-taxonomy-331b 69 | git stash 70 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 71 | git pull autopull perceptual-transfer 72 | 73 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 74 | 75 | END_USER_DATA 76 | ) 77 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 78 | 79 | aws ec2 request-spot-instances \ 80 | --spot-price $SPOT_PRICE \ 81 | --instance-count $INSTANCE_COUNT \ 82 | --region $ZONE \ 83 | --launch-specification \ 84 | "{ \ 85 | \"ImageId\":\"$AMI\", \ 86 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 87 | \"KeyName\":\"$KEY_NAME\", \ 88 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 89 | \"UserData\":\"$USER_DATA\", \ 90 | \"Placement\": { \ 91 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 92 | } \ 93 | }" 94 | sleep 1 95 | 96 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 97 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 98 | break 99 | fi 100 | done 101 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 102 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 103 | break 104 | fi 105 | done 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /code/tools/script/launch_transfer_viz.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-ebb87293" #extract 14 | #INSTANCE_TYPE="p2.xlarge" 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( a b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=100 27 | 28 | # DST tasks left out 29 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 30 | 31 | DST_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 32 | ego_motion fix_pose impainting_whole keypoint2d keypoint3d \ 33 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 34 | room_layout segment25d segment2d vanishing_point_well_defined \ 35 | segmentsemantic_rb" 36 | DST_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 37 | ego_motion fix_pose keypoint2d \ 38 | non_fixated_pose point_match rgb2depth rgb2mist \ 39 | room_layout segment2d \ 40 | segmentsemantic_rb" 41 | COUNTER=0 42 | #for src in $SRC_TASKS; do 43 | for dst in $DST_TASKS; do 44 | sleep 5 45 | COUNTER=$[$COUNTER +1] 46 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 47 | if [ "$COUNTER" -lt "$START_AT" ]; then 48 | echo "Skipping at $COUNTER (starting at $START_AT)" 49 | continue 50 | fi 51 | echo "running $COUNTER" 52 | 53 | if [[ "$platform" == "linux" ]]; 54 | then 55 | OPTIONS="-w 0" 56 | ECHO_OPTIONS="-d" 57 | else 58 | OPTIONS="" 59 | ECHO_OPTIONS="-D" 60 | fi 61 | 62 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 63 | export INSTANCE_TAG="${dst}"; 64 | # export INSTANCE_TAG="SASHA P2 WORK INSTANCE"; 65 | export HOME="/home/ubuntu" 66 | # export ACTION=SHUTDOWN; 67 | export ACTION=TRANSFER_VIZ; 68 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 69 | 70 | cd /home/ubuntu/task-taxonomy-331b 71 | git stash 72 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 73 | git pull autopull perceptual-transfer 74 | git pull autopull perceptual-transfer 75 | 76 | END_USER_DATA 77 | ) 78 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 79 | 80 | aws ec2 request-spot-instances \ 81 | --spot-price $SPOT_PRICE \ 82 | --instance-count $INSTANCE_COUNT \ 83 | --region $ZONE \ 84 | --launch-specification \ 85 | "{ \ 86 | \"ImageId\":\"$AMI\", \ 87 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 88 | \"KeyName\":\"$KEY_NAME\", \ 89 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 90 | \"UserData\":\"$USER_DATA\", \ 91 | \"Placement\": { \ 92 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 93 | } \ 94 | }" 95 | 96 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 97 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 98 | break 99 | fi 100 | done 101 | 102 | 103 | -------------------------------------------------------------------------------- /code/tools/script/launch_transfer_viz_second_order.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-d0a16fa8" #extract 14 | #INSTANCE_TYPE="p2.xlarge" 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( a b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=100 27 | 28 | # DST tasks left out 29 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 30 | DST_TASKS="autoencoder curvature denoise edge2d edge3d \ 31 | keypoint2d keypoint3d vanishing_point_well_defined \ 32 | reshade rgb2depth rgb2mist rgb2sfnorm \ 33 | room_layout segment2d segment25d segmentsemantic_rb" 34 | COUNTER=0 35 | #for src in $SRC_TASKS; do 36 | for dst in $DST_TASKS; do 37 | sleep 2 38 | COUNTER=$[$COUNTER +1] 39 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 40 | if [ "$COUNTER" -lt "$START_AT" ]; then 41 | echo "Skipping at $COUNTER (starting at $START_AT)" 42 | continue 43 | fi 44 | echo "running $COUNTER" 45 | 46 | if [[ "$platform" == "linux" ]]; 47 | then 48 | OPTIONS="-w 0" 49 | ECHO_OPTIONS="-d" 50 | else 51 | OPTIONS="" 52 | ECHO_OPTIONS="-D" 53 | fi 54 | 55 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 56 | export INSTANCE_TAG="${dst}"; 57 | # export INSTANCE_TAG="SASHA P2 WORK INSTANCE"; 58 | export HOME="/home/ubuntu" 59 | # export ACTION=SHUTDOWN; 60 | export ACTION=SECOND_ORDER_TRANSFER_VIZ; 61 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 62 | 63 | cd /home/ubuntu/task-taxonomy-331b 64 | git stash 65 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 66 | git pull autopull perceptual-transfer 67 | git pull autopull perceptual-transfer 68 | 69 | END_USER_DATA 70 | ) 71 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 72 | 73 | aws ec2 request-spot-instances \ 74 | --spot-price $SPOT_PRICE \ 75 | --instance-count $INSTANCE_COUNT \ 76 | --region $ZONE \ 77 | --launch-specification \ 78 | "{ \ 79 | \"ImageId\":\"$AMI\", \ 80 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 81 | \"KeyName\":\"$KEY_NAME\", \ 82 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 83 | \"UserData\":\"$USER_DATA\", \ 84 | \"Placement\": { \ 85 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 86 | } \ 87 | }" 88 | 89 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 90 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 91 | break 92 | fi 93 | done 94 | 95 | 96 | -------------------------------------------------------------------------------- /code/tools/script/launch_video.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-55c2792d" #extract 14 | #INSTANCE_TYPE="p2.xlarge" 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.001 21 | ZONE="us-west-2" 22 | SUB_ZONES=( b b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=100 27 | 28 | # Intermediate tasks left out 29 | # ego_motion 30 | # INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 31 | # fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 32 | # non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 33 | # room_layout segment25d segment2d vanishing_point_well_defined pixels random \ 34 | # segmentsemantic_rb class_selected class_1000" 35 | 36 | # INTERMEDIATE_TASKS="ego_motion" 37 | 38 | 39 | 40 | INTERMEDIATE_TASKS="autoencoder curvature denoise edge2d edge3d colorization jigsaw \ 41 | keypoint2d keypoint3d reshade rgb2depth rgb2mist rgb2sfnorm segment25d segment2d \ 42 | segmentsemantic_rb class_places class_1000 vanishing_point_well_defined room_layout" 43 | 44 | # DST tasks left out 45 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 46 | 47 | 48 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 49 | COUNTER=0 50 | #for src in $SRC_TASKS; do 51 | for intermediate in $INTERMEDIATE_TASKS; do 52 | sleep 1 53 | COUNTER=$[$COUNTER +1] 54 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 55 | if [ "$COUNTER" -lt "$START_AT" ]; then 56 | echo "Skipping at $COUNTER (starting at $START_AT)" 57 | continue 58 | fi 59 | echo "running $COUNTER" 60 | 61 | if [[ "$platform" == "linux" ]]; 62 | then 63 | OPTIONS="-w 0" 64 | ECHO_OPTIONS="-d" 65 | else 66 | OPTIONS="" 67 | ECHO_OPTIONS="-D" 68 | fi 69 | 70 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 71 | #export INSTANCE_TAG="final/${intermediate} --data-split val --places"; 72 | export INSTANCE_TAG="x --config final/${intermediate} --vid 4 --low-sat"; 73 | # export INSTANCE_TAG="SASHA P2 WORK INSTANCE"; 74 | export HOME="/home/ubuntu" 75 | # export ACTION=SHUTDOWN; 76 | export ACTION=VIDEO; 77 | #export ACTION=EXTRACT_REPS 78 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 79 | 80 | cd /home/ubuntu/task-taxonomy-331b 81 | git stash 82 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 83 | git pull autopull perceptual-transfer 84 | git pull autopull perceptual-transfer 85 | 86 | # bash /home/ubuntu/task-taxonomy-331b/tools/script/generate_all_transfer_configs.sh 87 | # python /home/ubuntu/task-taxonomy-331b/tools/transfer.py \ 88 | # /home/ubuntu/task-taxonomy-331b/experiments/full_taskonomy_beta1/${decode}/${data}/${intermediate}__${dst}__8__unlocked/ 89 | 90 | END_USER_DATA 91 | ) 92 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 93 | 94 | aws ec2 request-spot-instances \ 95 | --spot-price $SPOT_PRICE \ 96 | --instance-count $INSTANCE_COUNT \ 97 | --region $ZONE \ 98 | --launch-specification \ 99 | "{ \ 100 | \"ImageId\":\"$AMI\", \ 101 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 102 | \"KeyName\":\"$KEY_NAME\", \ 103 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 104 | \"UserData\":\"$USER_DATA\", \ 105 | \"Placement\": { \ 106 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 107 | } \ 108 | }" 109 | 110 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 111 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 112 | break 113 | fi 114 | done 115 | 116 | 117 | -------------------------------------------------------------------------------- /code/tools/script/launch_video_rep_extract.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-55c2792d" #extract 14 | #INSTANCE_TYPE="p2.xlarge" 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="c3.2xlarge" 17 | INSTANCE_COUNT=1 18 | KEY_NAME="taskonomy" 19 | SECURITY_GROUP="launch-wizard-1" 20 | SPOT_PRICE=1.21 21 | ZONE="us-west-2" 22 | SUB_ZONES=( b b c ) 23 | 24 | # 11 - X 25 | START_AT=1 26 | EXIT_AFTER=500 27 | 28 | # Intermediate tasks left out 29 | # ego_motion 30 | # INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 31 | # fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 32 | # non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 33 | # room_layout segment25d segment2d vanishing_point_well_defined pixels random \ 34 | # segmentsemantic_rb class_selected class_1000" 35 | 36 | # INTERMEDIATE_TASKS="ego_motion" 37 | sleep 90m 38 | 39 | INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 40 | fix_pose impainting_whole jigsaw keypoint2d keypoint3d \ 41 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 42 | room_layout segment25d segment2d vanishing_point_well_defined \ 43 | segmentsemantic_rb class_places class_1000 class_selected alex lsm cmu pose5 pose6 poseMatch random" 44 | INTERMEDIATE_TASKS="autoencoder colorization curvature denoise edge2d edge3d \ 45 | fix_pose impainting_whole jigsaw keypoint2d keypoint3d ego_motion \ 46 | non_fixated_pose point_match reshade rgb2depth rgb2mist rgb2sfnorm \ 47 | room_layout segment25d segment2d vanishing_point_well_defined \ 48 | segmentsemantic_rb class_places class_1000 class_selected random" 49 | 50 | # DST tasks left out 51 | # denoise fix_pose point_match class_1000 autoencoder non_fixated_pose rgb2depth segment2d keypoint2d 52 | 53 | 54 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 55 | COUNTER=0 56 | #for src in $SRC_TASKS; do 57 | for intermediate in $INTERMEDIATE_TASKS; do 58 | sleep 1 59 | COUNTER=$[$COUNTER +1] 60 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 61 | if [ "$COUNTER" -lt "$START_AT" ]; then 62 | echo "Skipping at $COUNTER (starting at $START_AT)" 63 | continue 64 | fi 65 | echo "running $COUNTER" 66 | 67 | if [[ "$platform" == "linux" ]]; 68 | then 69 | OPTIONS="-w 0" 70 | ECHO_OPTIONS="-d" 71 | else 72 | OPTIONS="" 73 | ECHO_OPTIONS="-D" 74 | fi 75 | 76 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 77 | export INSTANCE_TAG="final/${intermediate} --video --vid-id 4"; 78 | export HOME="/home/ubuntu" 79 | export ACTION=EXTRACT_REPS 80 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 81 | 82 | cd /home/ubuntu/task-taxonomy-331b 83 | git stash 84 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 85 | git pull autopull perceptual-transfer 86 | git pull autopull perceptual-transfer 87 | 88 | END_USER_DATA 89 | ) 90 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 91 | 92 | aws ec2 request-spot-instances \ 93 | --spot-price $SPOT_PRICE \ 94 | --instance-count $INSTANCE_COUNT \ 95 | --region $ZONE \ 96 | --launch-specification \ 97 | "{ \ 98 | \"ImageId\":\"$AMI\", \ 99 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 100 | \"KeyName\":\"$KEY_NAME\", \ 101 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 102 | \"UserData\":\"$USER_DATA\", \ 103 | \"Placement\": { \ 104 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 105 | } \ 106 | }" 107 | 108 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 109 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 110 | break 111 | fi 112 | done 113 | 114 | 115 | -------------------------------------------------------------------------------- /code/tools/script/launch_video_unfinished.sh: -------------------------------------------------------------------------------- 1 | platform='unknown' 2 | unamestr=`uname` 3 | if [[ "$unamestr" == 'Linux' ]]; then 4 | platform='linux' 5 | elif [[ "$unamestr" == 'Darwin' ]]; then 6 | platform='darwin' 7 | fi 8 | 9 | 10 | # 1-100: g3.4 11 | # 101-200: p2 12 | # AMI="ami-660ae31e" 13 | AMI="ami-26429b5e" #extract 14 | #AMI="ami-7428ff0c" #extract 15 | INSTANCE_TYPE="g3.4xlarge" 16 | #INSTANCE_TYPE="p2.xlarge" 17 | # INSTANCE_TYPE="p3.2xlarge" 18 | #INSTANCE_TYPE="c4.4xlarge" 19 | INSTANCE_COUNT=1 20 | KEY_NAME="taskonomy" 21 | SECURITY_GROUP="launch-wizard-1" 22 | SPOT_PRICE=1.001 23 | ZONE="us-west-2" 24 | SUB_ZONES=( a b c ) 25 | 26 | # 11 - X 27 | START_AT=1 28 | EXIT_AFTER=900 29 | DATA_USED="16k" 30 | 31 | #echo 'sleeping for 4 hrs...' 32 | #sleep 4h 33 | #INTERMEDIATE_TASKS="denoise__impainting_whole__autoencoder__8__unlocked" 34 | INTERMEDIATE_TASKS="high_order/DO_NOT_REPLACE_TARGET_DECODER/16k/13__autoencoder__8__unlocked" 35 | 36 | 37 | TARGET_DECODER_FUNCS="DO_NOT_REPLACE_TARGET_DECODER" 38 | COUNTER=0 39 | #for src in $SRC_TASKS; do 40 | for intermediate in $INTERMEDIATE_TASKS; do 41 | for decode in $TARGET_DECODER_FUNCS; do 42 | 43 | COUNTER=$[$COUNTER +1] 44 | SUB_ZONE=${SUB_ZONES[$((COUNTER%3))]} 45 | if [ "$COUNTER" -lt "$START_AT" ]; then 46 | echo "Skipping at $COUNTER (starting at $START_AT)" 47 | continue 48 | fi 49 | echo "running $COUNTER" 50 | 51 | 52 | if [[ "$platform" == "linux" ]]; 53 | then 54 | OPTIONS="-w 0" 55 | ECHO_OPTIONS="-d" 56 | else 57 | OPTIONS="" 58 | ECHO_OPTIONS="-D" 59 | fi 60 | 61 | USER_DATA=$(base64 $OPTIONS << END_USER_DATA 62 | export HOME="/home/ubuntu" 63 | 64 | export INSTANCE_TAG="x --config ${intermediate} --vid 4"; 65 | #export ACTION=TRANSFER; 66 | export ACTION=VIDEO; 67 | 68 | cd /home/ubuntu/task-taxonomy-331b 69 | git stash 70 | git remote add autopull https://alexsax:328d7b8a3e905c1400f293b9c4842fcae3b7dc54@github.com/alexsax/task-taxonomy-331b.git 71 | git pull autopull perceptual-transfer 72 | 73 | watch -n 300 "bash /home/ubuntu/task-taxonomy-331b/tools/script/reboot_if_disconnected.sh" &> /dev/null & 74 | 75 | END_USER_DATA 76 | ) 77 | echo "$USER_DATA" | base64 $ECHO_OPTIONS 78 | 79 | aws ec2 request-spot-instances \ 80 | --spot-price $SPOT_PRICE \ 81 | --instance-count $INSTANCE_COUNT \ 82 | --region $ZONE \ 83 | --launch-specification \ 84 | "{ \ 85 | \"ImageId\":\"$AMI\", \ 86 | \"InstanceType\":\"$INSTANCE_TYPE\", \ 87 | \"KeyName\":\"$KEY_NAME\", \ 88 | \"SecurityGroups\": [\"$SECURITY_GROUP\"], \ 89 | \"UserData\":\"$USER_DATA\", \ 90 | \"Placement\": { \ 91 | \"AvailabilityZone\": \"us-west-2${SUB_ZONE}\" \ 92 | } \ 93 | }" 94 | sleep 1 95 | 96 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 97 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 98 | break 99 | fi 100 | done 101 | if [ "$COUNTER" -ge "$EXIT_AFTER" ]; then 102 | echo "EXITING before $COUNTER (after $EXIT_AFTER)" 103 | break 104 | fi 105 | done 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /code/tools/script/list_instance_progress.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Name: list_instance_progress.py 3 | Desc: Prints out the step count at the last saved checkpoint for each saved model 4 | Usage: 5 | python list_instance_progress.py 6 | ''' 7 | from __future__ import absolute_import, division, print_function 8 | 9 | import os 10 | import tensorflow as tf 11 | import concurrent.futures 12 | 13 | def main( _ ): 14 | root_dir = '/home/ubuntu/s3/model_log/transfer' 15 | log_dir = 'logs/slim-train/' 16 | 17 | # list_of_task = ['autoencoder__autoencoder__1024'] 18 | list_of_task = os.listdir(root_dir) 19 | # list_of_task = "autoencoder__rgb2depth__1024 edge3d__autoencoder__1024 edge3d__edge3d__1024 edge3d__rgb2sfnorm__1024 impainting__keypoint3d__1024 keypoint3d__rgb2sfnorm__1024 reshade__keypoint2d__1024 reshade__keypoint3d__1024 rgb2depth__keypoint3d__1024 rgb2sfnorm__edge2d__1024 rgb2sfnorm__reshade__1024".split(" ") 20 | #print(list_of_task) 21 | task_step_list = [] 22 | for task in list_of_task: 23 | ckpt_dir = os.path.join( root_dir, task, log_dir ) 24 | try: 25 | full_path = tf.train.latest_checkpoint(ckpt_dir) 26 | step = full_path.split('-')[-1] 27 | except: 28 | print("Problem with {}".format(task)) 29 | step = 0 30 | task_step_list.append( (task, step) ) 31 | 32 | #print(task_step_list) 33 | print_steps(task_step_list) 34 | # start_model_copy_threads( task_step_list, root_dir, log_dir ) 35 | 36 | def print_steps(task_step_list): 37 | for task, step in task_step_list: 38 | print("{}: \t{}".format(task, step)) 39 | 40 | print("Not running:") 41 | bad_count = 0 42 | bad_list = [] 43 | for task, step in task_step_list: 44 | if int(step) < 7000: 45 | bad_count += 1 46 | bad_list.append(task) 47 | print("{}: \t{}".format(task, step)) 48 | print("Bad count: {}".format(bad_count)) 49 | print("bad list") 50 | print(" ".join(bad_list)) 51 | 52 | 53 | if __name__=='__main__': 54 | main( '' ) 55 | -------------------------------------------------------------------------------- /code/tools/script/make_config_retrain_config.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/tools/script/make_config_retrain_config.py -------------------------------------------------------------------------------- /code/tools/script/preprocess/filter_files.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | SUBSET = sys.argv[1] #'train' 4 | MODEL_SELECTION_FILE = '/cvgl/u/asax/task-taxonomy-331b/assets/data/{0}_models.txt'.format( SUBSET ) 5 | IMAGES_LIST_FILE = '/cvgl/u/asax/task-taxonomy-331b/assets/data/all_images.txt' 6 | OUTPUT_IMAGES_LIST_FILE = '/cvgl/u/asax/task-taxonomy-331b/assets/data/{0}_filenames.pkl'.format( SUBSET ) 7 | 8 | import numpy as np 9 | import pickle as pickle 10 | 11 | if __name__ == '__main__': 12 | valid_models = set() 13 | with open( MODEL_SELECTION_FILE, 'r' ) as fp: 14 | for line in fp: 15 | valid_models.add( line.strip() ) 16 | 17 | image_filepaths = [] 18 | with open( IMAGES_LIST_FILE, 'r' ) as fp: 19 | for line in fp: 20 | split_file_path = line.strip().split( "/" ) 21 | model = split_file_path[0] 22 | if model not in valid_models: 23 | continue 24 | image_filepaths.append( line.strip() ) 25 | 26 | with open( OUTPUT_IMAGES_LIST_FILE, 'w' ) as fp: 27 | pickle.dump( np.array( image_filepaths ), fp ) 28 | 29 | print( len( image_filepaths ) ) 30 | 31 | 32 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/img_info.sh: -------------------------------------------------------------------------------- 1 | declare -a arr=("curvature" "depth" "edge" "edge2d" "keypoint" "keypoint2d" "mist" "normal" "reshade" "segment25d" "segment2d") 2 | 3 | for i in "${arr[@]}" 4 | do 5 | img_info=$(identify -verbose ~/s3/2fycrku4FjW/$i/point_0_view_0_domain_$i.png ) 6 | dest=./infos/$i.txt 7 | echo -e "$img_info" > "./info/$i.txt" 8 | done 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/curvature.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/curvature/point_0_view_0_domain_curvature.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Resolution: 28.35x28.35 7 | Print size: 18.06x18.06 8 | Units: PixelsPerCentimeter 9 | Type: TrueColor 10 | Endianess: Undefined 11 | Colorspace: sRGB 12 | Depth: 8-bit 13 | Channel depth: 14 | red: 8-bit 15 | green: 8-bit 16 | blue: 1-bit 17 | Channel statistics: 18 | Pixels: 262144 19 | Red: 20 | min: 0 (0) 21 | max: 254 (0.996078) 22 | mean: 137.921 (0.540866) 23 | standard deviation: 48.3263 (0.189515) 24 | kurtosis: 1.18108 25 | skewness: 0.0575566 26 | Green: 27 | min: 0 (0) 28 | max: 254 (0.996078) 29 | mean: 125.09 (0.490551) 30 | standard deviation: 21.8794 (0.0858015) 31 | kurtosis: 19.0216 32 | skewness: -3.0805 33 | Blue: 34 | min: 0 (0) 35 | max: 0 (0) 36 | mean: 0 (0) 37 | standard deviation: 0 (0) 38 | kurtosis: 0 39 | skewness: 0 40 | Image statistics: 41 | Overall: 42 | min: 0 (0) 43 | max: 254 (0.996078) 44 | mean: 87.6704 (0.343805) 45 | standard deviation: 30.6275 (0.120108) 46 | kurtosis: 46.6802 47 | skewness: -1.32866 48 | Rendering intent: Perceptual 49 | Gamma: 0.454545 50 | Chromaticity: 51 | red primary: (0.64,0.33) 52 | green primary: (0.3,0.6) 53 | blue primary: (0.15,0.06) 54 | white point: (0.3127,0.329) 55 | Background color: white 56 | Border color: srgb(223,223,223) 57 | Matte color: grey74 58 | Transparent color: black 59 | Interlace: None 60 | Intensity: Undefined 61 | Compose: Over 62 | Page geometry: 512x512+0+0 63 | Dispose: Undefined 64 | Iterations: 0 65 | Compression: Zip 66 | Orientation: Undefined 67 | Properties: 68 | date:create: 1970-01-01T00:00:00+00:00 69 | date:modify: 2017-06-29T17:12:56+00:00 70 | png:IHDR.bit-depth-orig: 8 71 | png:IHDR.bit_depth: 8 72 | png:IHDR.color-type-orig: 2 73 | png:IHDR.color_type: 2 (Truecolor) 74 | png:IHDR.interlace_method: 0 (Not interlaced) 75 | png:IHDR.width,height: 512, 512 76 | png:pHYs: x_res=2835, y_res=2835, units=1 77 | png:sRGB: intent=0 (Perceptual Intent) 78 | signature: 3f5f430733e05eae8d646178390200281692a95f786e9d8e1adc29e0ff4f5d51 79 | Artifacts: 80 | filename: /home/ubuntu/s3/2fycrku4FjW/curvature/point_0_view_0_domain_curvature.png 81 | verbose: true 82 | Tainted: False 83 | Filesize: 231KB 84 | Number pixels: 262K 85 | Pixels per second: 8.738MB 86 | User time: 0.000u 87 | Elapsed time: 0:01.030 88 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 89 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/depth.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/depth/point_0_view_0_domain_depth.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Resolution: 28.35x28.35 7 | Print size: 18.06x18.06 8 | Units: PixelsPerCentimeter 9 | Type: Grayscale 10 | Endianess: Undefined 11 | Colorspace: Gray 12 | Depth: 16-bit 13 | Channel depth: 14 | gray: 16-bit 15 | Channel statistics: 16 | Pixels: 262144 17 | Gray: 18 | min: 324 (0.00494392) 19 | max: 65535 (1) 20 | mean: 1984.68 (0.0302843) 21 | standard deviation: 8444.02 (0.128847) 22 | kurtosis: 52.5151 23 | skewness: 7.37314 24 | Rendering intent: Undefined 25 | Gamma: 1 26 | Background color: gray(255) 27 | Border color: gray(223) 28 | Matte color: gray(189) 29 | Transparent color: gray(0) 30 | Interlace: None 31 | Intensity: Rec709Luminance 32 | Compose: Over 33 | Page geometry: 512x512+0+0 34 | Dispose: Undefined 35 | Iterations: 0 36 | Compression: Zip 37 | Orientation: Undefined 38 | Properties: 39 | date:create: 1970-01-01T00:00:00+00:00 40 | date:modify: 2017-06-29T17:12:58+00:00 41 | png:IHDR.bit-depth-orig: 16 42 | png:IHDR.bit_depth: 16 43 | png:IHDR.color-type-orig: 0 44 | png:IHDR.color_type: 0 (Grayscale) 45 | png:IHDR.interlace_method: 0 (Not interlaced) 46 | png:IHDR.width,height: 512, 512 47 | png:pHYs: x_res=2835, y_res=2835, units=1 48 | signature: f96b6e9dab3f471846430965b8052d769b7d916ed7fcab56dbfd96cba77c6e88 49 | Artifacts: 50 | filename: /home/ubuntu/s3/2fycrku4FjW/depth/point_0_view_0_domain_depth.png 51 | verbose: true 52 | Tainted: False 53 | Filesize: 98.3KB 54 | Number pixels: 262K 55 | Pixels per second: 6.554MB 56 | User time: 0.000u 57 | Elapsed time: 0:01.039 58 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 59 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/edge.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/edge/point_0_view_0_domain_edge.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Units: Undefined 7 | Type: Grayscale 8 | Endianess: Undefined 9 | Colorspace: Gray 10 | Depth: 16-bit 11 | Channel depth: 12 | gray: 16-bit 13 | Channel statistics: 14 | Pixels: 262144 15 | Gray: 16 | min: 0 (0) 17 | max: 3266 (0.049836) 18 | mean: 43.1052 (0.000657743) 19 | standard deviation: 186.853 (0.00285119) 20 | kurtosis: 101.687 21 | skewness: 9.35872 22 | Rendering intent: Undefined 23 | Gamma: 1 24 | Background color: gray(255) 25 | Border color: gray(223) 26 | Matte color: gray(189) 27 | Transparent color: gray(0) 28 | Interlace: None 29 | Intensity: Rec709Luminance 30 | Compose: Over 31 | Page geometry: 512x512+0+0 32 | Dispose: Undefined 33 | Iterations: 0 34 | Compression: Zip 35 | Orientation: Undefined 36 | Properties: 37 | date:create: 1970-01-01T00:00:00+00:00 38 | date:modify: 2017-06-29T17:13:00+00:00 39 | png:IHDR.bit-depth-orig: 16 40 | png:IHDR.bit_depth: 16 41 | png:IHDR.color-type-orig: 0 42 | png:IHDR.color_type: 0 (Grayscale) 43 | png:IHDR.interlace_method: 0 (Not interlaced) 44 | png:IHDR.width,height: 512, 512 45 | signature: 3212bff91a6d88ec9334d610952f1f3771582b1ed7d50dc063a4798b61c4607b 46 | Artifacts: 47 | filename: /home/ubuntu/s3/2fycrku4FjW/edge/point_0_view_0_domain_edge.png 48 | verbose: true 49 | Tainted: False 50 | Filesize: 124KB 51 | Number pixels: 262K 52 | Pixels per second: 6.554MB 53 | User time: 0.000u 54 | Elapsed time: 0:01.040 55 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 56 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/edge2d.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/edge2d/point_0_view_0_domain_edge2d.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Units: Undefined 7 | Type: Grayscale 8 | Endianess: Undefined 9 | Colorspace: Gray 10 | Depth: 16-bit 11 | Channel depth: 12 | gray: 16-bit 13 | Channel statistics: 14 | Pixels: 262144 15 | Gray: 16 | min: 0 (0) 17 | max: 7299 (0.111376) 18 | mean: 910.013 (0.0138859) 19 | standard deviation: 1078.91 (0.0164631) 20 | kurtosis: 5.3795 21 | skewness: 2.12222 22 | Rendering intent: Undefined 23 | Gamma: 1 24 | Background color: gray(255) 25 | Border color: gray(223) 26 | Matte color: gray(189) 27 | Transparent color: gray(0) 28 | Interlace: None 29 | Intensity: Rec709Luminance 30 | Compose: Over 31 | Page geometry: 512x512+0+0 32 | Dispose: Undefined 33 | Iterations: 0 34 | Compression: Zip 35 | Orientation: Undefined 36 | Properties: 37 | date:create: 1970-01-01T00:00:00+00:00 38 | date:modify: 2017-06-29T17:13:01+00:00 39 | png:IHDR.bit-depth-orig: 16 40 | png:IHDR.bit_depth: 16 41 | png:IHDR.color-type-orig: 0 42 | png:IHDR.color_type: 0 (Grayscale) 43 | png:IHDR.interlace_method: 0 (Not interlaced) 44 | png:IHDR.width,height: 512, 512 45 | signature: 3b17e23af198bb591b288785b68e151981b10f7d3ea2092f635e74ebf5ead941 46 | Artifacts: 47 | filename: /home/ubuntu/s3/2fycrku4FjW/edge2d/point_0_view_0_domain_edge2d.png 48 | verbose: true 49 | Tainted: False 50 | Filesize: 325KB 51 | Number pixels: 262K 52 | Pixels per second: 6.554MB 53 | User time: 0.010u 54 | Elapsed time: 0:01.039 55 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 56 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/keypoint.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/keypoint/point_0_view_0_domain_keypoint.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Units: Undefined 7 | Type: Grayscale 8 | Endianess: Undefined 9 | Colorspace: Gray 10 | Depth: 16-bit 11 | Channel depth: 12 | gray: 16-bit 13 | Channel statistics: 14 | Pixels: 262144 15 | Gray: 16 | min: 0 (0) 17 | max: 55796 (0.851392) 18 | mean: 5631.76 (0.0859351) 19 | standard deviation: 7223.57 (0.110225) 20 | kurtosis: 0.508596 21 | skewness: 1.14401 22 | Rendering intent: Undefined 23 | Gamma: 1 24 | Background color: gray(255) 25 | Border color: gray(223) 26 | Matte color: gray(189) 27 | Transparent color: gray(0) 28 | Interlace: None 29 | Intensity: Rec709Luminance 30 | Compose: Over 31 | Page geometry: 512x512+0+0 32 | Dispose: Undefined 33 | Iterations: 0 34 | Compression: Zip 35 | Orientation: Undefined 36 | Properties: 37 | date:create: 1970-01-01T00:00:00+00:00 38 | date:modify: 2017-06-29T17:13:05+00:00 39 | png:IHDR.bit-depth-orig: 16 40 | png:IHDR.bit_depth: 16 41 | png:IHDR.color-type-orig: 0 42 | png:IHDR.color_type: 0 (Grayscale) 43 | png:IHDR.interlace_method: 0 (Not interlaced) 44 | png:IHDR.width,height: 512, 512 45 | signature: d5cc9ce68e2af628fd1a3c3db6b0a987fcd52aae2c9e22072b92423a54b9a13d 46 | Artifacts: 47 | filename: /home/ubuntu/s3/2fycrku4FjW/keypoint/point_0_view_0_domain_keypoint.png 48 | verbose: true 49 | Tainted: False 50 | Filesize: 233KB 51 | Number pixels: 262K 52 | Pixels per second: 8.738MB 53 | User time: 0.010u 54 | Elapsed time: 0:01.030 55 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 56 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/mist.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/mist/point_0_view_0_domain_mist.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Resolution: 28.35x28.35 7 | Print size: 18.06x18.06 8 | Units: PixelsPerCentimeter 9 | Type: Grayscale 10 | Endianess: Undefined 11 | Colorspace: Gray 12 | Depth: 16-bit 13 | Channel depth: 14 | gray: 16-bit 15 | Channel statistics: 16 | Pixels: 262144 17 | Gray: 18 | min: 375 (0.00572213) 19 | max: 65535 (1) 20 | mean: 2062.16 (0.0314666) 21 | standard deviation: 8434.97 (0.128709) 22 | kurtosis: 52.4823 23 | skewness: 7.36979 24 | Rendering intent: Undefined 25 | Gamma: 1 26 | Background color: gray(255) 27 | Border color: gray(223) 28 | Matte color: gray(189) 29 | Transparent color: gray(0) 30 | Interlace: None 31 | Intensity: Rec709Luminance 32 | Compose: Over 33 | Page geometry: 512x512+0+0 34 | Dispose: Undefined 35 | Iterations: 0 36 | Compression: Zip 37 | Orientation: Undefined 38 | Properties: 39 | date:create: 1970-01-01T00:00:00+00:00 40 | date:modify: 2017-06-29T17:13:08+00:00 41 | png:IHDR.bit-depth-orig: 16 42 | png:IHDR.bit_depth: 16 43 | png:IHDR.color-type-orig: 0 44 | png:IHDR.color_type: 0 (Grayscale) 45 | png:IHDR.interlace_method: 0 (Not interlaced) 46 | png:IHDR.width,height: 512, 512 47 | png:pHYs: x_res=2835, y_res=2835, units=1 48 | signature: e51e8679e89bfd41817c3892b809212ad31b0ab854876eadf11339948479d5c3 49 | Artifacts: 50 | filename: /home/ubuntu/s3/2fycrku4FjW/mist/point_0_view_0_domain_mist.png 51 | verbose: true 52 | Tainted: False 53 | Filesize: 111KB 54 | Number pixels: 262K 55 | Pixels per second: 6.554MB 56 | User time: 0.000u 57 | Elapsed time: 0:01.039 58 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 59 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/info/normal.txt: -------------------------------------------------------------------------------- 1 | Image: /home/ubuntu/s3/2fycrku4FjW/normal/point_0_view_0_domain_normal.png 2 | Format: PNG (Portable Network Graphics) 3 | Mime type: image/png 4 | Class: DirectClass 5 | Geometry: 512x512+0+0 6 | Resolution: 28.35x28.35 7 | Print size: 18.06x18.06 8 | Units: PixelsPerCentimeter 9 | Type: TrueColor 10 | Endianess: Undefined 11 | Colorspace: sRGB 12 | Depth: 8-bit 13 | Channel depth: 14 | red: 8-bit 15 | green: 8-bit 16 | blue: 8-bit 17 | Channel statistics: 18 | Pixels: 262144 19 | Red: 20 | min: 0 (0) 21 | max: 255 (1) 22 | mean: 163.428 (0.640895) 23 | standard deviation: 82.6336 (0.324053) 24 | kurtosis: -1.39696 25 | skewness: -0.15667 26 | Green: 27 | min: 0 (0) 28 | max: 255 (1) 29 | mean: 133.425 (0.523235) 30 | standard deviation: 38.6222 (0.151459) 31 | kurtosis: 3.55843 32 | skewness: 0.434678 33 | Blue: 34 | min: 0 (0) 35 | max: 191 (0.74902) 36 | mean: 65.288 (0.256031) 37 | standard deviation: 49.5797 (0.19443) 38 | kurtosis: -1.63408 39 | skewness: -0.157714 40 | Image statistics: 41 | Overall: 42 | min: 0 (0) 43 | max: 255 (1) 44 | mean: 120.714 (0.473387) 45 | standard deviation: 59.9392 (0.235056) 46 | kurtosis: 2.74131 47 | skewness: 0.542226 48 | Rendering intent: Perceptual 49 | Gamma: 0.454545 50 | Chromaticity: 51 | red primary: (0.64,0.33) 52 | green primary: (0.3,0.6) 53 | blue primary: (0.15,0.06) 54 | white point: (0.3127,0.329) 55 | Background color: white 56 | Border color: srgb(223,223,223) 57 | Matte color: grey74 58 | Transparent color: black 59 | Interlace: None 60 | Intensity: Undefined 61 | Compose: Over 62 | Page geometry: 512x512+0+0 63 | Dispose: Undefined 64 | Iterations: 0 65 | Compression: Zip 66 | Orientation: Undefined 67 | Properties: 68 | date:create: 1970-01-01T00:00:00+00:00 69 | date:modify: 2017-06-29T17:13:12+00:00 70 | png:IHDR.bit-depth-orig: 8 71 | png:IHDR.bit_depth: 8 72 | png:IHDR.color-type-orig: 2 73 | png:IHDR.color_type: 2 (Truecolor) 74 | png:IHDR.interlace_method: 0 (Not interlaced) 75 | png:IHDR.width,height: 512, 512 76 | png:pHYs: x_res=2835, y_res=2835, units=1 77 | png:sRGB: intent=0 (Perceptual Intent) 78 | signature: 3fbcffe055a1353b2da7820f8a82eff9c9d83555af79e5dd84edfc72a2ab36b6 79 | Artifacts: 80 | filename: /home/ubuntu/s3/2fycrku4FjW/normal/point_0_view_0_domain_normal.png 81 | verbose: true 82 | Tainted: False 83 | Filesize: 187KB 84 | Number pixels: 262K 85 | Pixels per second: 6.554MB 86 | User time: 0.000u 87 | Elapsed time: 0:01.039 88 | Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-05-26 http://www.imagemagick.org 89 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/rename_all.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import os 3 | import pickle 4 | import concurrent.futures 5 | 6 | def change_name( model_id ): 7 | s3_model_dir = 's3://task-preprocessing-512/{ID}'.format(ID=model_id) 8 | shell_command = 'aws s3 --recursive mv {dir}/keypoint_2d {dir}/keypoint2d'.format(dir=s3_model_dir) 9 | result = subprocess.check_output(shell_command, shell=True) 10 | 11 | def main( _ ): 12 | with open('/home/ubuntu/task-taxonomy-331b/assets/aws_data/all_models.pkl', 'rb') as fp: 13 | data = pickle.load(fp) 14 | 15 | full_list = data['train'] + data['val'] + data['test'] 16 | 17 | #change_name(full_list[0]) 18 | with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor: 19 | result = executor.map(change_name, full_list[1:]) 20 | 21 | 22 | 23 | if __name__=='__main__': 24 | main( '' ) 25 | -------------------------------------------------------------------------------- /code/tools/script/preprocess/test_cpu.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('/home/ubuntu/task-taxonomy-331b/lib') 3 | import os 4 | import data.load_ops as lp 5 | import data.task_data_loading as dp 6 | import numpy as np 7 | import threading 8 | import tensorflow as tf 9 | import os, sys, time 10 | import concurrent.futures 11 | 12 | def main( _ ): 13 | root_dir = '/home/ubuntu/task-taxonomy-331b' 14 | meta_file = 'train_image_split_0.npy' 15 | images = np.load(os.path.join(root_dir, 'assets/aws_data', meta_file)) 16 | 17 | bucket_dir = '/home/ubuntu/s3' 18 | test_image = os.path.join(bucket_dir, images[3].decode('UTF-8')) 19 | print(test_image) 20 | 21 | # Test image name extension 22 | full_image_path = dp.make_filename_for_domain( test_image, 'rgb') 23 | print(full_image_path) 24 | 25 | # Test Image loading 26 | import time 27 | 28 | start = time.time() 29 | image_data = lp.load_raw_image( full_image_path ) 30 | 31 | end = time.time() 32 | print("Loading a image from S3 takes:") 33 | print(end - start) 34 | 35 | repeat = 10 36 | list_names = [full_image_path] * repeat 37 | start = time.time() 38 | with concurrent.futures.ThreadPoolExecutor(max_workers=repeat) as executor: 39 | executor.map(lp.load_raw_image, list_names ) 40 | end = time.time() 41 | print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 42 | print(end - start) 43 | 44 | repeat = 50 45 | list_names = [full_image_path] * repeat 46 | start = time.time() 47 | with concurrent.futures.ThreadPoolExecutor(max_workers=repeat) as executor: 48 | executor.map(lp.load_raw_image, list_names ) 49 | end = time.time() 50 | print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 51 | print(end - start) 52 | # repeat = 1 53 | # start = time.time() 54 | # pool = GreenPool(size=repeat) 55 | # for i in range(repeat): 56 | # pool.spawn_n(lp.load_from_aws, full_image_path) 57 | # pool.waitall() 58 | # end = time.time() 59 | # print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 60 | # print(end - start) 61 | 62 | 63 | # repeat = 10 64 | # start = time.time() 65 | # pool = GreenPool(size=repeat) 66 | # for i in range(repeat): 67 | # pool.spawn_n(lp.load_from_aws, full_image_path) 68 | # pool.waitall() 69 | # end = time.time() 70 | # print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 71 | # print(end - start) 72 | 73 | 74 | # repeat = 20 75 | # start = time.time() 76 | # pool = GreenPool(size=repeat) 77 | # for i in range(repeat): 78 | # pool.spawn_n(lp.load_from_aws, full_image_path) 79 | # pool.waitall() 80 | # end = time.time() 81 | # print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 82 | # print(end - start) 83 | 84 | # repeat = 30 85 | # start = time.time() 86 | # pool = GreenPool(size=repeat) 87 | # for i in range(repeat): 88 | # pool.spawn_n(lp.load_from_aws, full_image_path) 89 | # pool.waitall() 90 | # end = time.time() 91 | # print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 92 | # print(end - start) 93 | 94 | # repeat = 100 95 | # start = time.time() 96 | # pool = GreenPool(size=repeat) 97 | # for i in range(repeat): 98 | # pool.spawn_n(lp.load_from_aws, full_image_path) 99 | # pool.waitall() 100 | # end = time.time() 101 | # print("Downloading {repeat} times using {repeat} threads..".format(repeat=repeat)) 102 | # print(end - start) 103 | 104 | 105 | if __name__=='__main__': 106 | main( '' ) 107 | -------------------------------------------------------------------------------- /code/tools/script/print_command.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import argparse 4 | 5 | parser = argparse.ArgumentParser(description='Extract losses of encoder decoder model.') 6 | parser.add_argument('task', help='task to run') 7 | parser.add_argument('--action', dest='action') 8 | parser.add_argument('--data-split') 9 | parser.set_defaults(data_split="NOTHING") 10 | 11 | args = parser.parse_args() 12 | 13 | data_split = "" 14 | if args.data_split != "NOTHING": 15 | data_split = "--data-split {}".format(args.data_split) 16 | 17 | if args.action == "EXTRACT_REPS": 18 | print("python /home/ubuntu/task-taxonomy-331b/tools/extract_representations.py --cfg_dir /home/ubuntu/task-taxonomy-331b/experiments/transfers --task {} {}".format(args.task, data_split)) 19 | elif args.action == "EXTRACT_LOSSES": 20 | print("python /home/ubuntu/task-taxonomy-331b/tools/extract_losses.py --cfg_dir /home/ubuntu/task-taxonomy-331b/experiments/transfers --task {} {}".format(args.task, data_split)) 21 | elif args.action == "TRANSFER": 22 | print("python -u /home/ubuntu/task-taxonomy-331b/tools/transfer.py /home/ubuntu/task-taxonomy-331b/experiments/transfers/{}".format(args.task)) 23 | else: 24 | exit(1) 25 | -------------------------------------------------------------------------------- /code/tools/script/reboot_if_disconnected.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #ls /home/ubuntu/s3/experiment_models 4 | #if [ "$?" == "2" ] 5 | #then 6 | #reboot now 7 | #fi 8 | -------------------------------------------------------------------------------- /code/tools/script/rename_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | instance_id=$(/usr/bin/ec2metadata --instance-id) 3 | 4 | cat /home/ubuntu/task-taxonomy-331b/tools/task_list.txt | shuf > order.txt 5 | 6 | IFS=$'\r\n' GLOBIGNORE='*' command eval 'TASKS=($(cat order.txt))' 7 | #printf '%s\n' "${TASKS[@]}" 8 | 9 | for i in "${TASKS[@]}" 10 | do 11 | IFS='\*' read -ra ADDR <<< "$i" 12 | new_name="${ADDR[0]}_${ADDR[1]}" 13 | root="/home/ubuntu/task-taxonomy-331b/experiments/aws_batch" 14 | mv $root/$i $root/$new_name 15 | done 16 | 17 | -------------------------------------------------------------------------------- /code/tools/script/restructure_for_tensorboard.sh: -------------------------------------------------------------------------------- 1 | # Name: restructure_for_tensorboard.sh 2 | # 3 | # Desc: 4 | # Creates a new directory structure that's more tensorboard-friendly 5 | # It restructures the dictionary to be grouped by src/dst/arch through 6 | # symlinking the original dirs 7 | # 8 | # Note: 9 | # If a task was restarted early on then Tensorboard may crap out because there 10 | # is more than one event file. In that case, you should remove the offending 11 | # file with the following: 12 | # sudo find $ROOT_DIR -name '*.tfevents*' -size -100 -delete 13 | 14 | 15 | SRC_TASKS="autoencoder segment2d rgb2sfnorm reshade pixels random" 16 | DST_TASKS="autoencoder segment2d rgb2sfnorm reshade" 17 | 18 | MATCHES=$(mktemp) 19 | ROOT_DIR=/home/ubuntu/s3/experiment_models/pix_stream_transfer_8 20 | find $ROOT_DIR -type d -name '*logs*' > $MATCHES 21 | 22 | for SRC in $SRC_TASKS; 23 | do 24 | for DST in $DST_TASKS; 25 | do 26 | mkdir -p $SRC/$DST 27 | cd $SRC/$DST 28 | pwd 29 | 30 | QUERY=${SRC}/${DST}/logs 31 | QUERY_MATCHES=$(mktemp) 32 | 33 | cat $MATCHES | grep $QUERY > $QUERY_MATCHES 34 | while read f; do 35 | echo $f 36 | local_file="${f/$ROOT_DIR/.}" 37 | 38 | mkdir -p $local_file 39 | ln -s "$f" $local_file 40 | done < $QUERY_MATCHES 41 | cd - 42 | done 43 | done 44 | 45 | # QUERY=rt_ft 46 | # QUERY_MATCHES=$(mktemp) 47 | # cat $MATCHES | grep $QUERY > $QUERY_MATCHES 48 | # while read f; do 49 | # # echo $f 50 | # sudo rm -rf $f 51 | # done < $QUERY_MATCHES -------------------------------------------------------------------------------- /code/tools/script/run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | dirname="temp" 3 | mkdir -p -- "$dirname" 4 | 5 | task_name="" 6 | config_num="" 7 | moment=$(date +"%m%d_%T") 8 | #log_file="train_log_$moment.txt" 9 | log_file="train_log.txt" 10 | 11 | function usage 12 | { 13 | echo "-t or --task for task_name; -i or --config for config_num; -l or --log for log_file" 14 | } 15 | 16 | while [ "$1" != "" ] 17 | do 18 | case "$1" in 19 | -t | --task ) shift 20 | task_name=$1 21 | ;; 22 | -i | --config ) shift 23 | config_num="config_$1/" 24 | ;; 25 | -l | --log ) shift 26 | log_file=$1 27 | ;; 28 | -h | --help ) usage 29 | exit 30 | ;; 31 | * ) usage 32 | exit 1 33 | esac 34 | shift 35 | done 36 | 37 | echo "Running Experiment for Task: $task_name" 38 | echo "Using config: $config_num" 39 | echo "Logging to $log_file" 40 | 41 | if [ "$task_name" = "" ]; then 42 | echo "Task Name is empty..." 43 | exit 1 44 | fi 45 | 46 | root_dir="../experiments" 47 | aws_dir="/home/ubuntu/s3/model_log" 48 | 49 | #touch $root_dir/$task_name/$config_num$log_file 50 | python -u train.py $root_dir/$task_name/$config_num 2>&1 | tee $root_dir/$task_name/$config_num$log_file 51 | 52 | #python -u train.py $root_dir/$task_name/$config_num 2>&1 | tee $aws_dir/$task_name/$config_num$log_file 53 | -------------------------------------------------------------------------------- /code/tools/script/run_test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | dirname="temp" 3 | mkdir -p -- "$dirname" 4 | 5 | task_name="" 6 | config_num="" 7 | moment=$(date +"%m%d_%T") 8 | log_file="train_log_$moment.txt" 9 | 10 | function usage 11 | { 12 | echo "-t or --task for task_name; -i or --config for config_num; -l or --log for log_file" 13 | } 14 | 15 | while [ "$1" != "" ] 16 | do 17 | case "$1" in 18 | -t | --task ) shift 19 | task_name=$1 20 | ;; 21 | -i | --config ) shift 22 | config_num="config_$1/" 23 | ;; 24 | -l | --log ) shift 25 | log_file=$1 26 | ;; 27 | -h | --help ) usage 28 | exit 29 | ;; 30 | * ) usage 31 | exit 1 32 | esac 33 | shift 34 | done 35 | 36 | echo "Running Experiment for Task: $task_name" 37 | echo "Using config: $config_num" 38 | echo "Logging to $log_file" 39 | 40 | task_name="aws/fixated_pose" 41 | 42 | if [ "$task_name" = "" ]; then 43 | echo "Task Name is empty..." 44 | exit 1 45 | fi 46 | 47 | root_dir="/home/ubuntu/task-taxonomy-331b/experiments" 48 | #aws_dir="/home/ubuntu/s3/model_log/$task_name" 49 | 50 | #touch $root_dir/$task_name/$config_num$log_file 51 | python -u $root_dir/../tools/train.py $root_dir/$task_name/$config_num 2>&1 | tee $root_dir/$task_name/$config_num$log_file 52 | 53 | -------------------------------------------------------------------------------- /code/tools/script/temp.txt: -------------------------------------------------------------------------------- 1 | L2Jpbi9iYXNoIH4vdGFzay10YXhvbm9teS0zMzFiL3Rvb2xzL3NjcmlwdC9ydW5fdGVzdC5zaAo= 2 | -------------------------------------------------------------------------------- /code/tools/script/test.sh: -------------------------------------------------------------------------------- 1 | /bin/bash ~/task-taxonomy-331b/tools/script/run_test.sh 2 | -------------------------------------------------------------------------------- /code/tools/second_order_should_flip.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/code/tools/second_order_should_flip.pkl -------------------------------------------------------------------------------- /code/tools/task_list.txt: -------------------------------------------------------------------------------- 1 | autoencoder_0 2 | autoencoder_1 3 | autoencoder_2 4 | autoencoder_3 5 | colorization_0 6 | colorization_1 7 | colorization_2 8 | colorization_3 9 | curvature_0 10 | curvature_1 11 | curvature_2 12 | curvature_3 13 | denoise_0 14 | denoise_1 15 | denoise_2 16 | denoise_3 17 | edge2d_0 18 | edge2d_1 19 | edge2d_2 20 | edge2d_3 21 | edge3d_0 22 | edge3d_1 23 | edge3d_2 24 | edge3d_3 25 | fix_pose_0 26 | fix_pose_1 27 | fix_pose_2 28 | fix_pose_3 29 | impainting_0 30 | impainting_1 31 | impainting_2 32 | impainting_3 33 | jigsaw_0 34 | jigsaw_1 35 | jigsaw_2 36 | jigsaw_3 37 | keypoint2d_0 38 | keypoint2d_1 39 | keypoint2d_2 40 | keypoint2d_3 41 | keypoint3d_0 42 | keypoint3d_1 43 | keypoint3d_2 44 | keypoint3d_3 45 | non_fixated_pose_0 46 | non_fixated_pose_1 47 | non_fixated_pose_2 48 | non_fixated_pose_3 49 | point_match_0 50 | point_match_1 51 | point_match_2 52 | point_match_3 53 | reshade_0 54 | reshade_1 55 | reshade_2 56 | reshade_3 57 | rgb2depth_0 58 | rgb2depth_1 59 | rgb2depth_2 60 | rgb2depth_3 61 | rgb2mist_0 62 | rgb2mist_1 63 | rgb2mist_2 64 | rgb2mist_3 65 | rgb2sfnorm_0 66 | rgb2sfnorm_1 67 | rgb2sfnorm_2 68 | rgb2sfnorm_3 69 | room_layout_0 70 | room_layout_1 71 | room_layout_2 72 | room_layout_3 73 | segment25d_0 74 | segment25d_1 75 | segment25d_2 76 | segment25d_3 77 | segment2d_0 78 | segment2d_1 79 | segment2d_2 80 | segment2d_3 81 | vanishing_point_0 82 | vanishing_point_1 83 | vanishing_point_2 84 | vanishing_point_3 85 | -------------------------------------------------------------------------------- /code/tools/test.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Name: test.py 3 | Desc: Executes testing of a network. 4 | 5 | Usage: 6 | python test.py /path/to/cfgdir/ --gpu gpu_id 7 | ''' 8 | from __future__ import absolute_import, division, print_function 9 | 10 | import argparse 11 | import os 12 | import tensorflow as tf 13 | import tensorflow.contrib.slim as slim 14 | import time 15 | 16 | import init_paths 17 | import general_utils 18 | from general_utils import RuntimeDeterminedEnviromentVars 19 | import models.architectures as architectures 20 | from models.sample_models import * 21 | import utils 22 | 23 | parser = argparse.ArgumentParser(description='Train encoder decoder model.') 24 | parser.add_argument( 'cfg_dir', help='directory containing config.py file' ) 25 | parser.add_argument('--gpu', dest='gpu_id', 26 | help='GPU device id to use [0]', 27 | type=int) 28 | parser.add_argument('--nopause', dest='nopause', action='store_true') 29 | parser.set_defaults(nopause=False) 30 | 31 | def main( _ ): 32 | args = parser.parse_args() 33 | 34 | # Get available GPUs 35 | local_device_protos = utils.get_available_devices() 36 | print( 'Found devices:', [ x.name for x in local_device_protos ] ) 37 | # set GPU id 38 | if args.gpu_id: 39 | print( 'using gpu %d' % args.gpu_id ) 40 | os.environ[ 'CUDA_VISIBLE_DEVICES' ] = str( args.gpu_id ) 41 | else: 42 | print( 'no gpu specified' ) 43 | 44 | cfg = utils.load_config( args.cfg_dir, nopause=args.nopause ) 45 | run_training( cfg ) 46 | 47 | 48 | def run_training( cfg ): 49 | # set up logging 50 | tf.logging.set_verbosity( tf.logging.INFO ) 51 | 52 | with tf.Graph().as_default() as g: 53 | # create ops and placeholders 54 | inputs = utils.setup_input( cfg, is_training=False, use_filename_queue=True ) 55 | RuntimeDeterminedEnviromentVars.load_dynamic_variables( inputs, cfg ) 56 | RuntimeDeterminedEnviromentVars.populate_registered_variables() 57 | 58 | # build model (and losses and train_op) 59 | model = setup_model( inputs, cfg, is_training=False ) 60 | 61 | # set up metrics to evaluate 62 | names_to_values, names_to_updates = setup_metrics( inputs, model, cfg ) 63 | 64 | # execute training 65 | start_time = time.time() 66 | utils.print_start_info( cfg, inputs[ 'max_steps' ], is_training=False ) 67 | 68 | training_runners = { 'sess': tf.Session(), 'coord': tf.train.Coordinator() } 69 | data_prefetch_init_fn = utils.get_data_prefetch_threads_init_fn( inputs, cfg, is_training=False, use_filename_queue=True ) 70 | training_runners[ 'threads' ] = data_prefetch_init_fn( training_runners[ 'sess' ], training_runners[ 'coord' ] ) 71 | try: 72 | # This just returns the imput as output. It is for testing data 73 | # input only. 74 | for step in xrange( inputs[ 'max_steps' ] ): 75 | input_batch, target_batch, data_idx = training_runners['sess'].run( [ 76 | model['input_batch'], model['target_batch'], model[ 'data_idxs' ] ] ) 77 | 78 | if training_runners['coord'].should_stop(): 79 | break 80 | finally: 81 | utils.request_data_loading_end( training_runners ) 82 | utils.end_data_loading_and_sess( training_runners ) 83 | # else: # Use tf.slim 84 | # train_log_dir = os.path.join( cfg['log_dir'], 'slim-train' ) 85 | 86 | # # When ready to use a model, use the code below 87 | # train( model[ 'train_op' ], 88 | # train_log_dir, 89 | # get_data_prefetch_threads_init_fn( inputs, cfg ), 90 | # global_step=model[ 'global_step' ], 91 | # number_of_steps=inputs[ 'max_steps' ], 92 | # init_fn=model[ 'init_fn' ], 93 | # save_summaries_secs=300, 94 | # save_interval_secs=600, 95 | # saver=model[ 'saver_op' ] ) 96 | 97 | end_train_time = time.time() - start_time 98 | print('time to train %d epochs: %.3f hrs' % (cfg['num_epochs'], end_train_time/(60*60))) 99 | print('avg time per epoch: %.3f hrs' % ( (end_train_time/(60*60)) / cfg['num_epochs']) ) 100 | 101 | 102 | def setup_metrics( inputs, model, cfg ): 103 | # predictions = model[ 'model' ]. 104 | # Choose the metrics to compute: 105 | # names_to_values, names_to_updates = slim.metrics.aggregate_metric_map( {} ) 106 | return {}, {} 107 | 108 | if __name__=='__main__': 109 | main( '' ) 110 | -------------------------------------------------------------------------------- /code/tools/transfer_viz.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in {0..99} 4 | do 5 | python Debug_viz_for_transfer.py --idx $i --hs 256 6 | done 7 | -------------------------------------------------------------------------------- /data/LICENSE: -------------------------------------------------------------------------------- 1 | TASKONOMY DATASET END USER LICENSE AGREEMENT 2 | Last revision: October 21, 2021 3 | 4 | You (“Researcher” or “You”) are granted the right to use the Taskonomy Dataset (Dataset) under the following terms, as enlisted in this document (“License Agreement”): 5 | 6 | 1. Researcher may use, modify, improve and/or publish the Dataset only in connection with a research or educational purpose that is non-commercial or 7 | not-for-profit in nature, and not for any other purpose. 8 | 2. Any new access to the data shall be established through this form or the official method of distributing the data. The data may not be redistributed, in whole or part, or in any format without written prior permission. A reference to Taskonomy Dataset or this License Agreement must be made if you publish information derived from the data. 9 | 3. THE DATASET IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL TASKONOMY OR ANY CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATASET OR THE USE OR OTHER DEALINGS IN THE DATASET. 10 | 4. The right to revise this License Agreement, in whole or part, at any time without prior notice is reserved by the authors. 11 | 5. You warrant that you have the authorization to enter into this License Agreement. 12 | 6. A number of datasets and hardware stacks are integrated in the Taskonomy Dataset for optional use including Gibson (Xia et al 2018) and 2D3DS (Armeni et al 2017). The end user license agreement terms of those datasets are included in this License Agreement or appended to this License Agreement. 13 | 7. You comply with the terms enforced by the corporates whose products were used in collecting the data. The terms unanimously enforce, including but not limited to, restricting the use of the data to non-commercial use. 14 | 8. This License Agreement is for Taskonomy Dataset. Taskonomy Code is a software stack licensed under the MIT License. The license agreements of Taskonomy Dataset and Taskonomy Code are independent. 15 | 16 | Appended License Agreements: 17 | - Gibson Dataset of Spaces: http://svl.stanford.edu/gibson2/assets/GDS_agreement.pdf 18 | - 2D3DS: https://docs.google.com/forms/d/1Niyi45QTn0-nU3WKHjbswvndX7F2aaCpNWZOiJ7onYc 19 | 20 | FAQ: 21 | Q: I work for a commercial research organization. Can I use this data? 22 | A: Yes! We intend for employees of commercial research organizations to use 23 | this data as long as the purpose in using the data is for a research or 24 | educational purpose. 25 | -------------------------------------------------------------------------------- /data/assets/README.md: -------------------------------------------------------------------------------- 1 | assets for the subrepo 2 | -------------------------------------------------------------------------------- /data/assets/affinity.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/affinity.jpg -------------------------------------------------------------------------------- /data/assets/affinity_pre_post_AHP.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/affinity_pre_post_AHP.jpg -------------------------------------------------------------------------------- /data/assets/cauthron_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/cauthron_small.png -------------------------------------------------------------------------------- /data/assets/per_camera_point_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_camera_point_count.png -------------------------------------------------------------------------------- /data/assets/per_image_distance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_image_distance.png -------------------------------------------------------------------------------- /data/assets/per_image_elevation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_image_elevation.png -------------------------------------------------------------------------------- /data/assets/per_image_fov.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_image_fov.png -------------------------------------------------------------------------------- /data/assets/per_image_obliqueness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_image_obliqueness.png -------------------------------------------------------------------------------- /data/assets/per_image_point_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_image_point_count.png -------------------------------------------------------------------------------- /data/assets/per_image_roll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_image_roll.png -------------------------------------------------------------------------------- /data/assets/per_model_camera_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_model_camera_count.png -------------------------------------------------------------------------------- /data/assets/per_model_image_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_model_image_count.png -------------------------------------------------------------------------------- /data/assets/per_model_point_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_model_point_count.png -------------------------------------------------------------------------------- /data/assets/per_point_camera_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/per_point_camera_count.png -------------------------------------------------------------------------------- /data/assets/splits_taskonomy.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/splits_taskonomy.zip -------------------------------------------------------------------------------- /data/assets/task_tree.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/task_tree.jpg -------------------------------------------------------------------------------- /data/assets/web_frontpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/web_frontpage.png -------------------------------------------------------------------------------- /data/assets/web_frontpage_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/data/assets/web_frontpage_small.png -------------------------------------------------------------------------------- /results/README.md: -------------------------------------------------------------------------------- 1 | # [Taskonomy: Disentangling Task Transfer Learning](https://taskonomy.vision/) 2 | 3 | This folder contains the **raw and post-processed measurements of task affinities**, under various configurations (e.g. 1k/16k/etc images used for training transfer functions and measuring task affinities). The **win-rates** are included as well. 4 | 5 | This data was used for generating the task affinities reported in the figures 7 and 13 of the [paper](http://taskonomy.stanford.edu/#paper) (See below) and the transfer learning analysis. For more details, please see section 3.3 "Step III: Ordinal Normalization using Analytic 6 | Hierarchy Process (AHP)" of the [paper](http://taskonomy.stanford.edu/#paper). 7 | 8 |
9 | 10 |
11 | 12 | **First-order task affinity matrix before (left) and after (right) 13 | Analytic Hierarchy Process (AHP) normalization.** Lower means better 14 | transferred. (figure 7 of the [paper](http://taskonomy.stanford.edu/#paper) ) 15 | 16 | 17 | 18 |
19 | 20 |
21 | 22 | **Task Similarity Tree.** Agglomerative clustering of tasks 23 | based on their transferring-out patterns (i.e. using columns of normalized 24 | affinity matrix as task features). 3D, 2D, low dimensional geometric, and 25 | semantic tasks clustered together using a fully computational approach. (figure 14 of the [paper](http://taskonomy.stanford.edu/#paper) ) 26 | 27 | 28 | 29 | 30 | 31 | ## Citation 32 | If you find the affinities, code, models, or data useful, please cite this paper: 33 | ``` 34 | @inproceedings{zamir2018taskonomy, 35 | title={Taskonomy: Disentangling Task Transfer Learning}, 36 | author={Zamir, Amir R and Sax, Alexander and and Shen, William B and Guibas, Leonidas and Malik, Jitendra and Savarese, Silvio}, 37 | booktitle={2018 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}, 38 | year={2018}, 39 | organization={IEEE} 40 | } 41 | 42 | -------------------------------------------------------------------------------- /results/affinities/all_affinities.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/affinities/all_affinities.pkl -------------------------------------------------------------------------------- /results/affinities/all_affinities_16k.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/affinities/all_affinities_16k.pkl -------------------------------------------------------------------------------- /results/affinities/all_affinities_1k.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/affinities/all_affinities_1k.pkl -------------------------------------------------------------------------------- /results/winrates/wins_vs_pixels.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/winrates/wins_vs_pixels.pkl -------------------------------------------------------------------------------- /results/winrates/wins_vs_pixels_16k.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/winrates/wins_vs_pixels_16k.pkl -------------------------------------------------------------------------------- /results/winrates/wins_vs_pixels_1k.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/winrates/wins_vs_pixels_1k.pkl -------------------------------------------------------------------------------- /results/winrates/wins_vs_task.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/winrates/wins_vs_task.pkl -------------------------------------------------------------------------------- /results/winrates/wins_vs_task_16k.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/winrates/wins_vs_task_16k.pkl -------------------------------------------------------------------------------- /results/winrates/wins_vs_task_1k.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/results/winrates/wins_vs_task_1k.pkl -------------------------------------------------------------------------------- /taskbank/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /taskbank/assets/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/test.png -------------------------------------------------------------------------------- /taskbank/assets/test_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/test_1.png -------------------------------------------------------------------------------- /taskbank/assets/test_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/test_2.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/decoder_loss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/decoder_loss.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/distances_to_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/distances_to_point.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/elevations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/elevations.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/figure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/figure.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/losses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/losses.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/number_of_points_in_camera_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/number_of_points_in_camera_view.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/obliquess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/obliquess.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/pseudosemantics/coco_selected_classes.txt: -------------------------------------------------------------------------------- 1 | background 2 | bottle 3 | chair 4 | couch 5 | potted plant 6 | bed 7 | dining table 8 | toilet 9 | tv 10 | microwave 11 | oven 12 | toaster 13 | sink 14 | refrigerator 15 | book 16 | clock 17 | vase 18 | -------------------------------------------------------------------------------- /taskbank/assets/web_assets/pseudosemantics/imagenet_selected_classes.txt: -------------------------------------------------------------------------------- 1 | n02672831 accordion, piano accordion, squeeze box, 2 | n02676566 acoustic guitar, 3 | n02708093 analog clock, 4 | n02747177 ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin, 5 | n02769748 backpack, back pack, knapsack, packsack, rucksack, haversack, 6 | n02802426 basketball, 7 | n02804414 bassinet, 8 | n02808440 bathtub, bathing tub, bath, tub, 9 | n02870880 bookcase, 10 | n02906734 broom, 11 | n02909870 bucket, pail, 12 | n02948072 candle, taper, wax light, 13 | n02971356 carton, 14 | n02992529 cellular telephone, cellular phone, cellphone, cell, mobile phone, 15 | n02999410 chain, 16 | n03014705 chest, 17 | n03018349 china cabinet, china closet, 18 | n03063599 coffee mug, 19 | n03063689 coffeepot, 20 | n03085013 computer keyboard, keypad, 21 | n03127925 crate, 22 | n03131574 crib, cot, 23 | n03133878 Crock Pot, 24 | n03179701 desk, 25 | n03180011 desktop computer, 26 | n03187595 dial telephone, dial phone, 27 | n03196217 digital clock, 28 | n03201208 dining table, board, 29 | n03207743 dishrag, dishcloth, 30 | n03207941 dishwasher, dish washer, dishwashing machine, 31 | n03223299 doormat, welcome mat, 32 | n03271574 electric fan, blower, 33 | n03272010 electric guitar, 34 | n03290653 entertainment center, 35 | n03297495 espresso maker, 36 | n03337140 file, file cabinet, filing cabinet, 37 | n03376595 folding chair, 38 | n03388549 four-poster, 39 | n03452741 grand piano, grand, 40 | n03482405 hamper, 41 | n03529860 home theater, home theatre, 42 | n03584829 iron, smoothing iron, 43 | n03637318 lampshade, lamp shade, 44 | n03642806 laptop, laptop computer, 45 | n03691459 loudspeaker, speaker, speaker unit, loudspeaker system, speaker system, 46 | n03742115 medicine chest, medicine cabinet, 47 | n03761084 microwave, microwave oven, 48 | n03777754 modem, 49 | n03782006 monitor, 50 | n03793489 mouse, computer mouse, 51 | n03832673 notebook, notebook computer, 52 | n03887697 paper towel, 53 | n03899768 patio, terrace, 54 | n03916031 perfume, essence, 55 | n03924679 photocopier, 56 | n03930313 picket fence, paling, 57 | n03938244 pillow, 58 | n03958227 plastic bag, 59 | n03961711 plate rack, 60 | n03976657 pole, 61 | n03982430 pool table, billiard table, snooker table, 62 | n03983396 pop bottle, soda bottle, 63 | n03991062 pot, flowerpot, 64 | n04004767 printer, 65 | n04026417 purse, 66 | n04033995 quilt, comforter, comfort, puff, 67 | n04039381 racket, racquet, 68 | n04040759 radiator, 69 | n04041544 radio, wireless, 70 | n04070727 refrigerator, icebox, 71 | n04074963 remote control, remote, 72 | n04099969 rocking chair, rocker, 73 | n04120489 running shoe, 74 | n04131690 saltshaker, salt shaker, 75 | n04141975 scale, weighing machine, 76 | n04209239 shower curtain, 77 | n04239074 sliding door, 78 | n04254120 soap dispenser, 79 | n04254680 soccer ball, 80 | n04263257 soup bowl, 81 | n04326547 stone wall, 82 | n04330267 stove, 83 | n04344873 studio couch, day bed, 84 | n04372370 switch, electric switch, electrical switch, 85 | n04380533 table lamp, 86 | n04398044 teapot, 87 | n04404412 television, television system, 88 | n04442312 toaster, 89 | n04447861 toilet seat, 90 | n04517823 vacuum, vacuum cleaner, 91 | n04522168 vase, 92 | n04548280 wall clock, 93 | n04550184 wardrobe, closet, press, 94 | n04554684 washer, automatic washer, washing machine, 95 | n04589890 window screen, 96 | n04590129 window shade, 97 | n04591713 wine bottle, 98 | n07579787 plate, 99 | n07930864 cup, 100 | n15075141 toilet tissue, toilet paper, bathroom tissue, -------------------------------------------------------------------------------- /taskbank/assets/web_assets/rolls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/rolls.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/sample_outputs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/sample_outputs.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/sbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/sbs.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/task_definitions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/task_definitions.pdf -------------------------------------------------------------------------------- /taskbank/assets/web_assets/task_dict.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/task_dict.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/task_dict_v.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/task_dict_v.jpg -------------------------------------------------------------------------------- /taskbank/assets/web_assets/taskbank_tile_GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/taskbank_tile_GIF.gif -------------------------------------------------------------------------------- /taskbank/assets/web_assets/taskbank_tile_GIF_crop.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/taskbank_tile_GIF_crop.gif -------------------------------------------------------------------------------- /taskbank/assets/web_assets/test_pose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/test_pose.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/test_scene_class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/test_scene_class.png -------------------------------------------------------------------------------- /taskbank/assets/web_assets/test_sf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/assets/web_assets/test_sf.png -------------------------------------------------------------------------------- /taskbank/experiments/final/class_1000/config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import functools 4 | import numpy as np 5 | import os 6 | import sys 7 | import tensorflow as tf 8 | 9 | sys.path.insert( 1, os.path.realpath( '../../models' ) ) 10 | sys.path.insert( 1, os.path.realpath( '../../lib' ) ) 11 | 12 | import data.load_ops as load_ops 13 | from data.load_ops import mask_if_channel_le 14 | from data.task_data_loading import load_and_specify_preprocessors 15 | from general_utils import RuntimeDeterminedEnviromentVars 16 | import models.architectures as architectures 17 | from models.gan_discriminators import pix2pix_discriminator 18 | from models.resnet_v1 import resnet_v1_50_16x16 19 | from models.sample_models import * 20 | from models.utils import leaky_relu 21 | 22 | def get_cfg( nopause=False ): 23 | cfg = {} 24 | cfg['is_discriminative'] = True 25 | # params 26 | cfg['num_epochs'] = 30 27 | cfg['model_path'] = None 28 | 29 | # logging 30 | config_dir = os.path.dirname(os.path.realpath( __file__ )) 31 | task_name = os.path.basename( config_dir ) 32 | 33 | # model 34 | cfg['model_type'] = architectures.BasicFF 35 | cfg['weight_decay'] = 2e-6 36 | cfg['instance_noise_sigma'] = 0.1 37 | cfg['instance_noise_anneal_fn'] = tf.train.inverse_time_decay 38 | cfg['instance_noise_anneal_fn_kwargs'] = { 39 | 'decay_rate': 0.2, 40 | 'decay_steps': 1000 41 | } 42 | 43 | batch_size = 32 44 | cfg['encoder'] = resnet_encoder_fully_convolutional_16x16x8 45 | cfg['hidden_size'] = 1024 46 | cfg['encoder_kwargs'] = { 47 | 'resnet_build_fn' : resnet_v1_50_16x16, 48 | 'weight_decay': cfg['weight_decay'], 49 | 'flatten': True, 50 | 'batch_size': batch_size 51 | } 52 | 53 | cfg['return_accuracy']=True 54 | 55 | # learning 56 | cfg['initial_learning_rate'] = 1e-4 57 | cfg[ 'optimizer' ] = tf.train.AdamOptimizer 58 | cfg[ 'optimizer_kwargs' ] = {} 59 | 60 | 61 | def pwc(initial_lr, **kwargs): 62 | global_step = kwargs['global_step'] 63 | del kwargs['global_step'] 64 | return tf.train.piecewise_constant(global_step, **kwargs) 65 | cfg['learning_rate_schedule'] = pwc 66 | cfg['learning_rate_schedule_kwargs' ] = { 67 | 'boundaries': [np.int64(0), np.int64(80000)], # need to be int64 since global step is... 68 | 'values': [cfg['initial_learning_rate'], cfg['initial_learning_rate']/10] 69 | } 70 | # inputs 71 | cfg['input_dim'] = (256, 256) # (1024, 1024) 72 | cfg['input_num_channels'] = 3 73 | cfg['input_dtype'] = tf.float32 74 | cfg['input_domain_name'] = 'rgb' 75 | cfg['input_preprocessing_fn'] = load_ops.resize_rescale_image 76 | cfg['input_preprocessing_fn_kwargs'] = { 77 | 'new_dims': cfg['input_dim'], 78 | 'new_scale': [-1, 1] 79 | } 80 | cfg['single_filename_to_multiple']=True 81 | 82 | # outputs 83 | cfg['target_dim'] = 1000 # (1024, 1024) 84 | cfg['target_dtype'] = tf.float32 85 | cfg['target_from_filenames'] = load_ops.class_1000_softmax 86 | cfg['mask_by_target_func'] = True 87 | 88 | # Post processing 89 | cfg['metric_net'] = encoder_multilayers_fc_bn 90 | cfg['metric_kwargs'] = { 91 | 'hidden_size': 2048, 92 | 'layer_num': 2, 93 | 'output_size': cfg['target_dim'] 94 | } 95 | 96 | # input pipeline 97 | cfg['preprocess_fn'] = load_and_specify_preprocessors 98 | cfg['randomize'] = False 99 | cfg['num_read_threads'] = 300 100 | cfg['batch_size'] = batch_size 101 | cfg['inputs_queue_capacity'] = 4096 102 | 103 | # Checkpoints and summaries 104 | cfg['summary_save_every_secs'] = 300 105 | cfg['checkpoint_save_every_secs'] = 600 106 | 107 | RuntimeDeterminedEnviromentVars.register_dict( cfg ) # These will be loaded at runtime 108 | print_cfg( cfg, nopause=nopause ) 109 | return cfg 110 | 111 | def print_cfg( cfg, nopause=False ): 112 | print('-------------------------------------------------') 113 | print('config:') 114 | template = '\t{0:30}{1}' 115 | for key in sorted( cfg.keys() ): 116 | print(template.format(key, cfg[key])) 117 | print('-------------------------------------------------') 118 | 119 | if nopause: 120 | return 121 | raw_input('Press Enter to continue...') 122 | print('-------------------------------------------------') 123 | -------------------------------------------------------------------------------- /taskbank/experiments/final/class_places/config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import functools 4 | import numpy as np 5 | import os 6 | import sys 7 | import tensorflow as tf 8 | 9 | sys.path.insert( 1, os.path.realpath( '../../models' ) ) 10 | sys.path.insert( 1, os.path.realpath( '../../lib' ) ) 11 | 12 | import data.load_ops as load_ops 13 | from data.load_ops import mask_if_channel_le 14 | from data.task_data_loading import load_and_specify_preprocessors 15 | from general_utils import RuntimeDeterminedEnviromentVars 16 | import models.architectures as architectures 17 | from models.gan_discriminators import pix2pix_discriminator 18 | from models.resnet_v1 import resnet_v1_50_16x16 19 | from models.sample_models import * 20 | from models.utils import leaky_relu 21 | 22 | def get_cfg( nopause=False ): 23 | cfg = {} 24 | cfg['is_discriminative'] = True 25 | # params 26 | cfg['num_epochs'] = 30 27 | cfg['model_path'] = None 28 | 29 | # logging 30 | config_dir = os.path.dirname(os.path.realpath( __file__ )) 31 | task_name = os.path.basename( config_dir ) 32 | 33 | # model 34 | cfg['model_type'] = architectures.BasicFF 35 | cfg['weight_decay'] = 1e-5 36 | cfg['instance_noise_sigma'] = 0.1 37 | cfg['instance_noise_anneal_fn'] = tf.train.inverse_time_decay 38 | cfg['instance_noise_anneal_fn_kwargs'] = { 39 | 'decay_rate': 0.2, 40 | 'decay_steps': 1000 41 | } 42 | 43 | batch_size = 32 44 | cfg['encoder'] = resnet_encoder_fully_convolutional_16x16x8 45 | cfg['hidden_size'] = 1024 46 | cfg['encoder_kwargs'] = { 47 | 'resnet_build_fn' : resnet_v1_50_16x16, 48 | 'weight_decay': cfg['weight_decay'], 49 | 'flatten': True, 50 | 'batch_size': batch_size 51 | } 52 | 53 | cfg['return_accuracy']=True 54 | 55 | # learning 56 | cfg['initial_learning_rate'] = 1e-4 57 | cfg[ 'optimizer' ] = tf.train.AdamOptimizer 58 | cfg[ 'optimizer_kwargs' ] = {} 59 | 60 | 61 | def pwc(initial_lr, **kwargs): 62 | global_step = kwargs['global_step'] 63 | del kwargs['global_step'] 64 | return tf.train.piecewise_constant(global_step, **kwargs) 65 | cfg['learning_rate_schedule'] = pwc 66 | cfg['learning_rate_schedule_kwargs' ] = { 67 | 'boundaries': [np.int64(0), np.int64(80000)], # need to be int64 since global step is... 68 | 'values': [cfg['initial_learning_rate'], cfg['initial_learning_rate']/10] 69 | } 70 | # inputs 71 | cfg['input_dim'] = (256, 256) # (1024, 1024) 72 | cfg['input_num_channels'] = 3 73 | cfg['input_dtype'] = tf.float32 74 | cfg['input_domain_name'] = 'rgb' 75 | cfg['input_preprocessing_fn'] = load_ops.resize_rescale_image 76 | cfg['input_preprocessing_fn_kwargs'] = { 77 | 'new_dims': cfg['input_dim'], 78 | 'new_scale': [-1, 1] 79 | } 80 | cfg['single_filename_to_multiple']=True 81 | 82 | # outputs 83 | cfg['target_dim'] = 63 # (1024, 1024) 84 | cfg['target_dtype'] = tf.float32 85 | cfg['target_from_filenames'] = load_ops.class_places_workspace_and_home 86 | cfg['mask_by_target_func'] = True 87 | 88 | # Post processing 89 | cfg['metric_net'] = encoder_multilayers_fc_bn 90 | cfg['metric_kwargs'] = { 91 | 'hidden_size': 2048, 92 | 'layer_num': 2, 93 | 'output_size': cfg['target_dim'] 94 | } 95 | 96 | # input pipeline 97 | cfg['preprocess_fn'] = load_and_specify_preprocessors 98 | cfg['randomize'] = True 99 | cfg['num_read_threads'] = 300 100 | cfg['batch_size'] = batch_size 101 | cfg['inputs_queue_capacity'] = 4096 102 | 103 | # Checkpoints and summaries 104 | cfg['summary_save_every_secs'] = 300 105 | cfg['checkpoint_save_every_secs'] = 600 106 | RuntimeDeterminedEnviromentVars.register_dict( cfg ) # These will be loaded at runtime 107 | print_cfg( cfg, nopause=nopause ) 108 | return cfg 109 | 110 | def print_cfg( cfg, nopause=False ): 111 | print('-------------------------------------------------') 112 | print('config:') 113 | template = '\t{0:30}{1}' 114 | for key in sorted( cfg.keys() ): 115 | print(template.format(key, cfg[key])) 116 | print('-------------------------------------------------') 117 | 118 | if nopause: 119 | return 120 | raw_input('Press Enter to continue...') 121 | print('-------------------------------------------------') 122 | -------------------------------------------------------------------------------- /taskbank/experiments/final/curvature/config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import functools 4 | import numpy as np 5 | import os 6 | import sys 7 | import tensorflow as tf 8 | 9 | sys.path.insert( 1, os.path.realpath( '../../models' ) ) 10 | sys.path.insert( 1, os.path.realpath( '../../lib' ) ) 11 | 12 | import data.load_ops as load_ops 13 | from data.load_ops import mask_if_channel_le 14 | from data.task_data_loading import load_and_specify_preprocessors 15 | from general_utils import RuntimeDeterminedEnviromentVars 16 | import models.architectures as architectures 17 | from models.gan_discriminators import pix2pix_discriminator 18 | from models.resnet_v1 import resnet_v1_50_16x16 19 | from models.sample_models import * 20 | from models.utils import leaky_relu 21 | 22 | def get_cfg( nopause=False ): 23 | cfg = {} 24 | 25 | # params 26 | cfg['num_epochs'] = 30 27 | cfg['model_path'] = None 28 | 29 | # logging 30 | config_dir = os.path.dirname(os.path.realpath( __file__ )) 31 | task_name = os.path.basename( config_dir ) 32 | 33 | # model 34 | cfg['model_type'] = architectures.EncoderDecoderWithCGAN 35 | cfg['n_g_steps_before_d'] = 1 36 | cfg['n_d_steps_after_g'] = 1 37 | cfg['init_g_steps'] = 25000 38 | cfg['l_norm_weight_prop'] = 0.996 39 | cfg['weight_decay'] = 1e-6 # 1e-7, 1 40 | cfg['instance_noise_sigma'] = 0.1 41 | cfg['instance_noise_anneal_fn'] = tf.train.inverse_time_decay 42 | cfg['instance_noise_anneal_fn_kwargs'] = { 43 | 'decay_rate': 0.2, 44 | 'decay_steps': 1000 45 | } 46 | 47 | cfg['encoder'] = resnet_encoder_fully_convolutional_16x16x8 48 | cfg['hidden_size'] = 1024 49 | cfg['encoder_kwargs'] = { 50 | 'resnet_build_fn' : resnet_v1_50_16x16, 51 | 'weight_decay': cfg['weight_decay'] 52 | } 53 | cfg['decoder'] = decoder_fc_15_layer_256_resolution_fully_convolutional_16x16x4 54 | cfg['decoder_kwargs'] = { 55 | 'activation_fn': leaky_relu( 0.2 ), 56 | 'weight_decay': cfg['weight_decay'] 57 | } 58 | cfg['discriminator'] = pix2pix_discriminator 59 | cfg['discriminator_kwargs'] = { 60 | 'n_layers': 5, 61 | 'stride': 4, 62 | 'n_channel_multiplier': 64, 63 | 'weight_decay': 10.*cfg['weight_decay'] 64 | } 65 | 66 | # loss 67 | cfg['gan_loss_kwargs'] = { 68 | 'real_label': 0.9, # Positive labels 1 -> 0.9 69 | 'fake_label': 0.0 70 | } 71 | 72 | # learning 73 | cfg['initial_learning_rate'] = 1e-4 74 | cfg[ 'optimizer' ] = tf.train.AdamOptimizer 75 | cfg[ 'optimizer_kwargs' ] = {} 76 | cfg[ 'discriminator_learning_args' ] = { 77 | 'initial_learning_rate':1e-5, 78 | 'optimizer': tf.train.GradientDescentOptimizer, 79 | 'optimizer_kwargs': {} 80 | } 81 | 82 | # inputs 83 | cfg['input_dim'] = (256, 256) # (1024, 1024) 84 | cfg['input_num_channels'] = 3 85 | cfg['input_dtype'] = tf.float32 86 | cfg['input_domain_name'] = 'rgb' 87 | cfg['input_preprocessing_fn'] = load_ops.resize_rescale_image 88 | cfg['input_preprocessing_fn_kwargs'] = { 89 | 'new_dims': cfg['input_dim'], 90 | 'new_scale': [-1, 1] 91 | } 92 | 93 | # outputs 94 | cfg['target_num_channels'] = 2 95 | cfg['target_dim'] = (256, 256) # (1024, 1024) 96 | cfg['target_dtype'] = tf.float32 97 | cfg['target_domain_name'] = 'curvature' 98 | cfg['target_preprocessing_fn'] = load_ops.curvature_preprocess 99 | cfg['target_preprocessing_fn_kwargs'] = { 100 | 'new_dims': cfg['target_dim'] 101 | } 102 | 103 | # masks 104 | cfg['depth_mask'] = True 105 | cfg['l2_loss'] = True 106 | 107 | # input pipeline 108 | cfg['preprocess_fn'] = load_and_specify_preprocessors 109 | cfg['randomize'] = False 110 | cfg['num_read_threads'] = 300 111 | cfg['batch_size'] = 32 112 | cfg['inputs_queue_capacity'] = 4096 113 | 114 | # Checkpoints and summaries 115 | cfg['summary_save_every_secs'] = 300 116 | cfg['checkpoint_save_every_secs'] = 600 117 | RuntimeDeterminedEnviromentVars.register_dict( cfg ) # These will be loaded at runtime 118 | print_cfg( cfg, nopause=nopause ) 119 | return cfg 120 | 121 | def print_cfg( cfg, nopause=False ): 122 | print('-------------------------------------------------') 123 | print('config:') 124 | template = '\t{0:30}{1}' 125 | for key in sorted( cfg.keys() ): 126 | print(template.format(key, cfg[key])) 127 | print('-------------------------------------------------') 128 | 129 | if nopause: 130 | return 131 | raw_input('Press Enter to continue...') 132 | print('-------------------------------------------------') 133 | -------------------------------------------------------------------------------- /taskbank/experiments/final/room_layout/config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import functools 4 | import numpy as np 5 | import os 6 | import sys 7 | import tensorflow as tf 8 | 9 | sys.path.insert( 1, os.path.realpath( '../../models' ) ) 10 | sys.path.insert( 1, os.path.realpath( '../../lib' ) ) 11 | 12 | import data.load_ops as load_ops 13 | from data.load_ops import mask_if_channel_le 14 | from data.task_data_loading import load_and_specify_preprocessors 15 | from general_utils import RuntimeDeterminedEnviromentVars 16 | import models.architectures as architectures 17 | from models.gan_discriminators import pix2pix_discriminator 18 | from models.resnet_v1 import resnet_v1_50_16x16 19 | from models.sample_models import * 20 | from models.utils import leaky_relu 21 | 22 | def get_cfg( nopause=False ): 23 | cfg = {} 24 | cfg['is_discriminative'] = True 25 | # params 26 | cfg['num_epochs'] = 30 27 | cfg['model_path'] = None 28 | 29 | # logging 30 | config_dir = os.path.dirname(os.path.realpath( __file__ )) 31 | task_name = os.path.basename( config_dir ) 32 | 33 | # model 34 | cfg['model_type'] = architectures.BasicFF 35 | cfg['weight_decay'] = 2e-6 36 | cfg['instance_noise_sigma'] = 0.1 37 | cfg['instance_noise_anneal_fn'] = tf.train.inverse_time_decay 38 | cfg['instance_noise_anneal_fn_kwargs'] = { 39 | 'decay_rate': 0.2, 40 | 'decay_steps': 1000 41 | } 42 | 43 | batch_size = 32 44 | cfg['encoder'] = resnet_encoder_fully_convolutional_16x16x8 45 | cfg['hidden_size'] = 1024 46 | cfg['encoder_kwargs'] = { 47 | 'resnet_build_fn' : resnet_v1_50_16x16, 48 | 'weight_decay': cfg['weight_decay'], 49 | 'flatten': True, 50 | 'batch_size': batch_size 51 | } 52 | 53 | cfg['return_accuracy']=False 54 | 55 | # learning 56 | cfg['initial_learning_rate'] = 1e-4 57 | cfg[ 'optimizer' ] = tf.train.AdamOptimizer 58 | cfg[ 'optimizer_kwargs' ] = {} 59 | 60 | cfg['clip_norm'] = 1 61 | 62 | def pwc(initial_lr, **kwargs): 63 | global_step = kwargs['global_step'] 64 | del kwargs['global_step'] 65 | return tf.train.piecewise_constant(global_step, **kwargs) 66 | cfg['learning_rate_schedule'] = pwc 67 | cfg['learning_rate_schedule_kwargs' ] = { 68 | 'boundaries': [np.int64(0), np.int64(80000)], # need to be int64 since global step is... 69 | 'values': [cfg['initial_learning_rate'], cfg['initial_learning_rate']/10] 70 | } 71 | # inputs 72 | cfg['input_dim'] = (256, 256) # (1024, 1024) 73 | cfg['input_num_channels'] = 3 74 | cfg['input_dtype'] = tf.float32 75 | cfg['input_domain_name'] = 'rgb' 76 | cfg['input_preprocessing_fn'] = load_ops.resize_rescale_image 77 | cfg['input_preprocessing_fn_kwargs'] = { 78 | 'new_dims': cfg['input_dim'], 79 | 'new_scale': [-1, 1] 80 | } 81 | cfg['single_filename_to_multiple']=True 82 | 83 | # outputs 84 | cfg['target_dim'] = 9 # (1024, 1024) 85 | cfg['target_dtype'] = tf.float32 86 | cfg['target_from_filenames'] = load_ops.room_layout 87 | 88 | # Post processing 89 | cfg['metric_net'] = encoder_multilayers_fc_bn 90 | cfg['metric_kwargs'] = { 91 | 'hidden_size': 2048, 92 | 'layer_num': 2, 93 | 'output_size': cfg['target_dim'] 94 | } 95 | 96 | cfg['l2_loss']=True 97 | cfg['loss_threshold']=1.0 98 | # input pipeline 99 | cfg['preprocess_fn'] = load_and_specify_preprocessors 100 | cfg['randomize'] = False 101 | cfg['num_read_threads'] = 300 102 | cfg['batch_size'] = batch_size 103 | cfg['inputs_queue_capacity'] = 4096 104 | 105 | # Checkpoints and summaries 106 | cfg['summary_save_every_secs'] = 300 107 | cfg['checkpoint_save_every_secs'] = 600 108 | RuntimeDeterminedEnviromentVars.register_dict( cfg ) # These will be loaded at runtime 109 | print_cfg( cfg, nopause=nopause ) 110 | return cfg 111 | 112 | def print_cfg( cfg, nopause=False ): 113 | print('-------------------------------------------------') 114 | print('config:') 115 | template = '\t{0:30}{1}' 116 | for key in sorted( cfg.keys() ): 117 | print(template.format(key, cfg[key])) 118 | print('-------------------------------------------------') 119 | 120 | if nopause: 121 | return 122 | raw_input('Press Enter to continue...') 123 | print('-------------------------------------------------') 124 | -------------------------------------------------------------------------------- /taskbank/experiments/final/segment25d/config.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import, division, print_function 2 | 3 | import functools 4 | import numpy as np 5 | import os 6 | import sys 7 | import tensorflow as tf 8 | 9 | sys.path.insert( 1, os.path.realpath( '../../models' ) ) 10 | sys.path.insert( 1, os.path.realpath( '../../lib' ) ) 11 | 12 | import data.load_ops as load_ops 13 | from data.load_ops import mask_if_channel_le 14 | from data.task_data_loading import load_and_specify_preprocessors 15 | from general_utils import RuntimeDeterminedEnviromentVars 16 | import models.architectures as architectures 17 | from models.gan_discriminators import pix2pix_discriminator 18 | from models.resnet_v1 import resnet_v1_50_16x16 19 | from models.sample_models import * 20 | from models.utils import leaky_relu 21 | 22 | def get_cfg( nopause=False ): 23 | cfg = {} 24 | 25 | # params 26 | cfg['num_epochs'] = 30 27 | cfg['model_path'] = None 28 | 29 | # logging 30 | config_dir = os.path.dirname(os.path.realpath( __file__ )) 31 | task_name = os.path.basename( config_dir ) 32 | 33 | # model 34 | cfg['model_type'] = architectures.SegmentationEncoderDecoder 35 | cfg['weight_decay'] = 2e-6 36 | cfg['instance_noise_sigma'] = 0.1 37 | cfg['instance_noise_anneal_fn'] = tf.train.inverse_time_decay 38 | cfg['instance_noise_anneal_fn_kwargs'] = { 39 | 'decay_rate': 0.2, 40 | 'decay_steps': 1000 41 | } 42 | 43 | cfg['encoder'] = resnet_encoder_fully_convolutional_16x16x8 44 | cfg['hidden_size'] = 1024 45 | cfg['encoder_kwargs'] = { 46 | 'resnet_build_fn' : resnet_v1_50_16x16, 47 | 'weight_decay': cfg['weight_decay'] 48 | } 49 | 50 | cfg['decoder'] = decoder_fc_15_layer_256_resolution_fully_convolutional_16x16x4 51 | cfg['decoder_kwargs'] = { 52 | 'activation_fn': leaky_relu( 0.2 ), 53 | 'weight_decay': cfg['weight_decay'] 54 | } 55 | 56 | # learning 57 | cfg['initial_learning_rate'] = 1e-4 58 | cfg[ 'optimizer' ] = tf.train.AdamOptimizer 59 | cfg[ 'optimizer_kwargs' ] = {} 60 | def pwc(initial_lr, **kwargs): 61 | global_step = kwargs['global_step'] 62 | del kwargs['global_step'] 63 | return tf.train.piecewise_constant(global_step, **kwargs) 64 | cfg['learning_rate_schedule'] = pwc 65 | cfg['learning_rate_schedule_kwargs' ] = { 66 | 'boundaries': [np.int64(0), np.int64(80000)], # need to be int64 since global step is... 67 | 'values': [cfg['initial_learning_rate'], cfg['initial_learning_rate']/10] 68 | } 69 | # inputs 70 | cfg['input_dim'] = (256, 256) # (1024, 1024) 71 | cfg['input_num_channels'] = 3 72 | cfg['input_dtype'] = tf.float32 73 | cfg['input_domain_name'] = 'rgb' 74 | cfg['input_preprocessing_fn'] = load_ops.resize_rescale_image 75 | cfg['input_preprocessing_fn_kwargs'] = { 76 | 'new_dims': cfg['input_dim'], 77 | 'new_scale': [-1, 1] 78 | } 79 | 80 | # outputs 81 | cfg['output_dim'] = (256,256) 82 | cfg['num_pixels'] = 300 83 | cfg['only_target_discriminative'] = True 84 | cfg['target_num_channels'] = 64 85 | cfg['target_dim'] = (cfg['num_pixels'], 3) # (1024, 1024) 86 | cfg['target_dtype'] = tf.int32 87 | cfg['target_domain_name'] = 'segment25d' 88 | 89 | cfg['target_from_filenames'] = load_ops.segment_pixel_sample 90 | cfg['target_from_filenames_kwargs'] = { 91 | 'new_dims': cfg['output_dim'], 92 | 'num_pixels': cfg['num_pixels'], 93 | 'domain': cfg['target_domain_name'] 94 | } 95 | 96 | cfg['return_accuracy'] = False 97 | 98 | # input pipeline 99 | cfg['preprocess_fn'] = load_and_specify_preprocessors 100 | cfg['randomize'] = False 101 | cfg['num_read_threads'] = 300 102 | cfg['batch_size'] = 32 103 | cfg['inputs_queue_capacity'] = 4096 104 | 105 | # Checkpoints and summaries 106 | cfg['summary_save_every_secs'] = 300 107 | cfg['checkpoint_save_every_secs'] = 600 108 | RuntimeDeterminedEnviromentVars.register_dict( cfg ) # These will be loaded at runtime 109 | print_cfg( cfg, nopause=nopause ) 110 | return cfg 111 | 112 | def print_cfg( cfg, nopause=False ): 113 | print('-------------------------------------------------') 114 | print('config:') 115 | template = '\t{0:30}{1}' 116 | for key in sorted( cfg.keys() ): 117 | print(template.format(key, cfg[key])) 118 | print('-------------------------------------------------') 119 | 120 | if nopause: 121 | return 122 | raw_input('Press Enter to continue...') 123 | print('-------------------------------------------------') 124 | -------------------------------------------------------------------------------- /taskbank/lib/data/DejaVuSerifCondensed.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/DejaVuSerifCondensed.ttf -------------------------------------------------------------------------------- /taskbank/lib/data/camera_mean_and_std.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/camera_mean_and_std.pkl -------------------------------------------------------------------------------- /taskbank/lib/data/class_idx.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/class_idx.pkl -------------------------------------------------------------------------------- /taskbank/lib/data/jigsaw_max_hamming_set.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/jigsaw_max_hamming_set.npy -------------------------------------------------------------------------------- /taskbank/lib/data/places_class_to_keep.txt: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 0 4 | 1 5 | 0 6 | 0 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | 0 18 | 0 19 | 0 20 | 0 21 | 0 22 | 0 23 | 0 24 | 0 25 | 0 26 | 0 27 | 1 28 | 0 29 | 0 30 | 0 31 | 0 32 | 0 33 | 0 34 | 0 35 | 0 36 | 0 37 | 0 38 | 0 39 | 0 40 | 0 41 | 0 42 | 0 43 | 0 44 | 1 45 | 0 46 | 1 47 | 0 48 | 0 49 | 0 50 | 0 51 | 0 52 | 1 53 | 1 54 | 0 55 | 0 56 | 0 57 | 0 58 | 0 59 | 0 60 | 0 61 | 0 62 | 0 63 | 0 64 | 1 65 | 0 66 | 0 67 | 0 68 | 0 69 | 0 70 | 0 71 | 0 72 | 0 73 | 0 74 | 0 75 | 0 76 | 0 77 | 0 78 | 0 79 | 0 80 | 0 81 | 0 82 | 0 83 | 0 84 | 0 85 | 0 86 | 0 87 | 0 88 | 0 89 | 0 90 | 1 91 | 0 92 | 0 93 | 0 94 | 0 95 | 0 96 | 1 97 | 0 98 | 0 99 | 0 100 | 0 101 | 0 102 | 0 103 | 0 104 | 0 105 | 0 106 | 0 107 | 0 108 | 0 109 | 0 110 | 0 111 | 0 112 | 0 113 | 0 114 | 0 115 | 0 116 | 0 117 | 0 118 | 0 119 | 0 120 | 0 121 | 0 122 | 1 123 | 0 124 | 0 125 | 1 126 | 0 127 | 0 128 | 0 129 | 0 130 | 0 131 | 0 132 | 0 133 | 0 134 | 0 135 | 0 136 | 0 137 | 0 138 | 0 139 | 0 140 | 0 141 | 0 142 | 0 143 | 0 144 | 0 145 | 0 146 | 0 147 | 0 148 | 0 149 | 0 150 | 0 151 | 0 152 | 0 153 | 0 154 | 0 155 | 0 156 | 0 157 | 1 158 | 0 159 | 0 160 | 0 161 | 0 162 | 0 163 | 0 164 | 0 165 | 0 166 | 0 167 | 0 168 | 0 169 | 0 170 | 0 171 | 0 172 | 0 173 | 0 174 | 0 175 | 0 176 | 0 177 | 1 178 | 1 179 | 0 180 | 0 181 | 0 182 | 0 183 | 1 184 | 0 185 | 0 186 | 0 187 | 0 188 | 0 189 | 0 190 | 0 191 | 0 192 | 0 193 | 0 194 | 0 195 | 0 196 | 0 197 | 0 198 | 0 199 | 0 200 | 0 201 | 0 202 | 0 203 | 0 204 | 1 205 | 0 206 | 0 207 | 0 208 | 0 209 | 1 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 0 216 | 1 217 | 0 218 | 0 219 | 0 220 | 0 221 | 0 222 | 0 223 | 0 224 | 0 225 | 0 226 | 0 227 | 0 228 | 0 229 | 0 230 | 0 231 | 0 232 | 0 233 | 0 234 | 0 235 | 0 236 | 0 237 | 0 238 | 0 239 | 0 240 | 0 241 | 1 242 | 1 243 | 0 244 | 0 245 | 0 246 | 0 247 | 0 248 | 0 249 | 0 250 | 0 251 | 0 252 | 0 253 | 0 254 | 1 255 | 0 256 | 0 257 | 0 258 | 0 259 | 0 260 | 0 261 | 0 262 | 0 263 | 0 264 | 0 265 | 0 266 | 0 267 | 0 268 | 0 269 | 0 270 | 1 271 | 0 272 | 0 273 | 0 274 | 0 275 | 0 276 | 0 277 | 0 278 | 0 279 | 0 280 | 0 281 | 0 282 | 1 283 | 0 284 | 0 285 | 0 286 | 1 287 | 0 288 | 0 289 | 0 290 | 0 291 | 0 292 | 0 293 | 0 294 | 0 295 | 0 296 | 0 297 | 0 298 | 0 299 | 0 300 | 0 301 | 0 302 | 0 303 | 0 304 | 1 305 | 0 306 | 0 307 | 0 308 | 0 309 | 0 310 | 0 311 | 0 312 | 1 313 | 0 314 | 0 315 | 0 316 | 0 317 | 0 318 | 1 319 | 0 320 | 0 321 | 0 322 | 0 323 | 0 324 | 0 325 | 0 326 | 0 327 | 0 328 | 0 329 | 1 330 | 0 331 | 0 332 | 0 333 | 0 334 | 0 335 | 0 336 | 0 337 | 0 338 | 0 339 | 0 340 | 0 341 | 0 342 | 0 343 | 0 344 | 1 345 | 0 346 | 0 347 | 0 348 | 0 349 | 0 350 | 0 351 | 0 352 | 0 353 | 0 354 | 0 355 | 0 356 | 0 357 | 0 358 | 0 359 | 1 360 | 0 361 | 0 362 | 0 363 | 0 364 | 1 365 | 0 366 | -------------------------------------------------------------------------------- /taskbank/lib/data/prior_factor.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/prior_factor.npy -------------------------------------------------------------------------------- /taskbank/lib/data/prior_factor_in_door.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/prior_factor_in_door.npy -------------------------------------------------------------------------------- /taskbank/lib/data/pts_in_hull.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/pts_in_hull.npy -------------------------------------------------------------------------------- /taskbank/lib/data/selected_class.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/selected_class.npy -------------------------------------------------------------------------------- /taskbank/lib/data/semseg_avg_inv.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/semseg_avg_inv.npy -------------------------------------------------------------------------------- /taskbank/lib/data/semseg_prior_factor.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StanfordVL/taskonomy/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/data/semseg_prior_factor.npy -------------------------------------------------------------------------------- /taskbank/lib/general_utils.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Defines general utility functions 3 | ''' 4 | from models.architectures import ALLOWABLE_TYPES as ALLOWABLE_MODEL_TYPES 5 | 6 | import os 7 | 8 | 9 | ############################# 10 | # Dynamically set variables 11 | ############################# 12 | class RuntimeDeterminedEnviromentVars( object ): 13 | ''' 14 | Example use: 15 | inputs = { 'num_samples_epoch': 100 } 16 | cfg = { 'batch_size': 5, 'epoch_steps': [ '', 'steps_per_epoch' ] } 17 | 18 | for key, value in cfg.items(): 19 | if isinstance( value, list ) and len( value ) == 2 and value[0] == 'LOAD_DYNAMIC': 20 | RuntimeDeterminedEnviromentVars.register( cfg, key, value[1] ) 21 | 22 | RuntimeDeterminedEnviromentVars.load_dynamic_variables( inputs, cfg ) 23 | RuntimeDeterminedEnviromentVars.populate_registered_variables() 24 | print( cfg ) # epoch_steps = 20 25 | ''' 26 | registered_variables = [] 27 | is_loaded = False 28 | # These are initialized in load_dynamic_variables 29 | steps_per_epoch = '' # An int that condains the number of steps the network will take per epoch 30 | 31 | @classmethod 32 | def load_dynamic_variables( cls, inputs, cfg ): 33 | ''' 34 | Args: 35 | inputs: a dict from train.py 36 | cfg: a dict from a config.py 37 | ''' 38 | cls.steps_per_epoch = inputs[ 'num_samples_epoch' ] // cfg[ 'batch_size' ] 39 | cls.is_loaded = True 40 | 41 | @classmethod 42 | def register( cls, dict_containing_field_to_populate, field_name, attr_name ): 43 | cls.registered_variables.append( [dict_containing_field_to_populate, field_name, attr_name] ) 44 | 45 | @classmethod 46 | def register_dict( cls, dict_to_register ): 47 | ''' 48 | Registers any fields in the dict that should be dynamically loaded. 49 | Such fields should have value: [ '', attr_name ] 50 | ''' 51 | for key, value in dict_to_register.items(): 52 | if isinstance( value, list ) and len( value ) == 2 and value[0] == '': 53 | cls.register( dict_to_register, key, value[1] ) 54 | elif isinstance( value, dict ): 55 | cls.register_dict( value ) 56 | 57 | @classmethod 58 | def populate_registered_variables( cls ): 59 | print( "dynamically populating variables:" ) 60 | for dict_containing_field_to_populate, field_name, attr_name in cls.registered_variables: 61 | dict_containing_field_to_populate[field_name] = getattr( cls, attr_name ) 62 | print( "\t{0}={1}".format( field_name, getattr( cls, attr_name ) ) ) 63 | 64 | 65 | ########################### 66 | # Utility functions 67 | ########################### 68 | def validate_config( cfg ): 69 | ''' 70 | Catches many general cfg errors. 71 | ''' 72 | if cfg[ 'model_type' ] not in ALLOWABLE_MODEL_TYPES: 73 | raise ValueError( "'model_type' in config.py must be one of {0}".format( ALLOWABLE_MODEL_TYPES )) 74 | if cfg[ 'model_type' ] is not 'empty' and 'optimizer' not in cfg: 75 | raise ValueError( "an 'optimizer' must be specified".format( ALLOWABLE_MODEL_TYPES )) 76 | if 'optimizer' in cfg and 'optimizer_kwargs' not in cfg: 77 | raise ValueError( "The arguments for the optimizer {0} must be given, named, in 'optimizer_kwargs'".format( cfg[ 'optimizer' ] )) 78 | 79 | 80 | def load_config( cfg_dir, nopause=False ): 81 | ''' 82 | Raises: 83 | FileNotFoundError if 'config.py' doesn't exist in cfg_dir 84 | ''' 85 | if not os.path.isfile( os.path.join( cfg_dir, 'config.py' ) ): 86 | raise ImportError( 'config.py not found in {0}'.format( cfg_dir ) ) 87 | import sys 88 | try: 89 | del sys.modules[ 'config' ] 90 | except: 91 | pass 92 | 93 | sys.path.insert( 0, cfg_dir ) 94 | import config as loading_config 95 | # cleanup 96 | # print([ v for v in sys.modules if "config" in v]) 97 | # return 98 | cfg = loading_config.get_cfg( nopause ) 99 | 100 | try: 101 | del sys.modules[ 'config' ] 102 | except: 103 | pass 104 | sys.path.remove(cfg_dir) 105 | 106 | return cfg 107 | 108 | def update_keys(old_dict, key_starts_with, new_dict): 109 | for k, v in new_dict.items(): 110 | if k.startswith(key_starts_with): 111 | old_dict[k] = v 112 | return old_dict -------------------------------------------------------------------------------- /taskbank/lib/models/architectures.py: -------------------------------------------------------------------------------- 1 | ''' architectures.py 2 | 3 | Contains high-level model architectures assembled from smaller parts 4 | ''' 5 | from __future__ import absolute_import, division, print_function 6 | 7 | import argparse 8 | import os 9 | import tensorflow as tf 10 | import tensorflow.contrib.slim as slim 11 | 12 | from models.encoder_decoder import StandardED as EncoderDecoder 13 | from models.encoder_decoder_cgan import EDWithCGAN as EncoderDecoderWithCGAN 14 | from models.encoder_decoder_cgan_softmax import EDWithSoftmaxRegenerationCGAN as EDSoftmaxRegenCGAN 15 | from models.siamese_nets import StandardSiamese as Siamese 16 | from models.cycle_siamese_nets import CycleSiamese as CycleSiamese 17 | from models.basic_feedforward import StandardFeedforward as BasicFF 18 | from models.encoder_decoder_segmentation import SegmentationED as SegmentationEncoderDecoder 19 | from models.encoder_decoder_segmentation_semantic import SemSegED 20 | from models.encoder_decoder_softmax import SoftmaxED as EDSoftmax 21 | 22 | ALLOWABLE_TYPES = [ 23 | BasicFF, 24 | CycleSiamese, 25 | EncoderDecoderWithCGAN, 26 | EncoderDecoder, 27 | EDSoftmax, 28 | EDSoftmaxRegenCGAN, 29 | SegmentationEncoderDecoder, 30 | SemSegED, 31 | Siamese, 32 | 'empty' ] 33 | -------------------------------------------------------------------------------- /taskbank/lib/models/base_net.py: -------------------------------------------------------------------------------- 1 | ''' 2 | General config.py options that can be used for all models. : 3 | ''' 4 | import tensorflow as tf 5 | import tensorflow.contrib.slim as slim 6 | 7 | from optimizers import ops as optimizers 8 | 9 | class BaseNet(object): 10 | 11 | def __init__(self, global_step, cfg): 12 | self.cfg = cfg 13 | self.decoder_only = False 14 | self.extended_summaries = False 15 | if 'extended_summaries' in cfg: 16 | self.extended_summaries = cfg['extended_summaries'] 17 | 18 | def build_model(self): 19 | raise NotImplementedError( 'build_model not implemented') 20 | 21 | def get_losses(self): 22 | raise NotImplementedError( 'get_losses not implemented') 23 | 24 | def build_train_op( self, global_step ): 25 | if not self.model_built or self.total_loss is None: 26 | raise RuntimeError( "Cannot build optimizers until 'build_model' ({0}) and 'get_losses' {1} are run".format( 27 | self.model_built, self.total_loss is not None ) ) 28 | self.global_step = global_step 29 | self.optimizer = optimizers.build_optimizer( global_step=global_step, cfg=self.cfg ) 30 | self.train_op = slim.learning.create_train_op( self.total_loss, self.optimizer ) 31 | 32 | def train_step(self): 33 | raise NotImplementedError( 'train_step not implemented' ) 34 | 35 | def get_train_step_fn(self): 36 | return slim.learning.train_step -------------------------------------------------------------------------------- /taskbank/lib/models/resnet_config.py: -------------------------------------------------------------------------------- 1 | # This is a variable scope aware configuation object for TensorFlow 2 | 3 | import tensorflow as tf 4 | 5 | FLAGS = tf.app.flags.FLAGS 6 | 7 | class Config: 8 | def __init__(self): 9 | root = self.Scope('') 10 | for k, v in FLAGS.__dict__['__flags'].items(): 11 | root[k] = v 12 | self.stack = [ root ] 13 | 14 | def iteritems(self): 15 | return self.to_dict().items() 16 | 17 | def to_dict(self): 18 | self._pop_stale() 19 | out = {} 20 | # Work backwards from the flags to top fo the stack 21 | # overwriting keys that were found earlier. 22 | for i in range(len(self.stack)): 23 | cs = self.stack[-i] 24 | for name in cs: 25 | out[name] = cs[name] 26 | return out 27 | 28 | def _pop_stale(self): 29 | var_scope_name = tf.get_variable_scope().name 30 | top = self.stack[0] 31 | while not top.contains(var_scope_name): 32 | # We aren't in this scope anymore 33 | self.stack.pop(0) 34 | top = self.stack[0] 35 | 36 | def __getitem__(self, name): 37 | self._pop_stale() 38 | # Recursively extract value 39 | for i in range(len(self.stack)): 40 | cs = self.stack[i] 41 | if name in cs: 42 | return cs[name] 43 | 44 | raise KeyError(name) 45 | 46 | def set_default(self, name, value): 47 | if not name in self: 48 | self[name] = value 49 | 50 | def __contains__(self, name): 51 | self._pop_stale() 52 | for i in range(len(self.stack)): 53 | cs = self.stack[i] 54 | if name in cs: 55 | return True 56 | return False 57 | 58 | def __setitem__(self, name, value): 59 | self._pop_stale() 60 | top = self.stack[0] 61 | var_scope_name = tf.get_variable_scope().name 62 | assert top.contains(var_scope_name) 63 | 64 | if top.name != var_scope_name: 65 | top = self.Scope(var_scope_name) 66 | self.stack.insert(0, top) 67 | 68 | top[name] = value 69 | 70 | class Scope(dict): 71 | def __init__(self, name): 72 | self.name = name 73 | 74 | def contains(self, var_scope_name): 75 | return var_scope_name.startswith(self.name) 76 | 77 | 78 | 79 | # Test 80 | if __name__ == '__main__': 81 | 82 | def assert_raises(exception, fn): 83 | try: 84 | fn() 85 | except exception: 86 | pass 87 | else: 88 | assert False, "Expected exception" 89 | 90 | c = Config() 91 | 92 | c['hello'] = 1 93 | assert c['hello'] == 1 94 | 95 | with tf.variable_scope('foo'): 96 | c.set_default("bar", 10) 97 | c['bar'] = 2 98 | assert c['bar'] == 2 99 | assert c['hello'] == 1 100 | 101 | c.set_default("mario", True) 102 | 103 | with tf.variable_scope('meow'): 104 | c['dog'] = 3 105 | assert c['dog'] == 3 106 | assert c['bar'] == 2 107 | assert c['hello'] == 1 108 | 109 | assert c['mario'] == True 110 | 111 | assert_raises(KeyError, lambda: c['dog']) 112 | assert c['bar'] == 2 113 | assert c['hello'] == 1 114 | 115 | 116 | -------------------------------------------------------------------------------- /taskbank/requirement.txt: -------------------------------------------------------------------------------- 1 | absl-py==0.1.10 2 | awsebcli==3.12.3 3 | bleach==1.5.0 4 | blessed==1.14.2 5 | boto3==1.5.32 6 | botocore==1.9.0 7 | cement==2.8.2 8 | certifi==2018.1.18 9 | click==6.7 10 | colorama==0.3.7 11 | cycler==0.10.0 12 | decorator==4.2.1 13 | dockerpty==0.4.1 14 | docopt==0.6.2 15 | docutils==0.14 16 | Flask==0.12.2 17 | gunicorn==19.7.1 18 | html5lib==0.9999999 19 | itsdangerous==0.24 20 | Jinja2==2.10 21 | jmespath==0.9.3 22 | Markdown==2.6.11 23 | MarkupSafe==1.0 24 | matplotlib==2.0.2 25 | mock==2.0.0 26 | networkx==2.1 27 | numpy==1.12.1 28 | olefile==0.45.1 29 | pathspec==0.5.5 30 | pbr==3.1.1 31 | Pillow==4.2.1 32 | protobuf==3.4.0 33 | pyparsing==2.2.0 34 | python-dateutil==2.6.1 35 | pytz==2018.3 36 | PyYAML==3.12 37 | requests==2.9.1 38 | s3transfer==0.1.11 39 | scikit-image==0.12.3 40 | scikit-learn==0.19.0 41 | scipy==1.0.0 42 | semantic-version==2.5.0 43 | six==1.11.0 44 | tabulate==0.7.5 45 | tensorflow==1.5.0 46 | tensorflow-tensorboard==1.5.1 47 | termcolor==1.1.0 48 | transforms3d==0.3.1 49 | wcwidth==0.1.7 50 | websocket-client==0.47.0 51 | Werkzeug==0.14.1 52 | 53 | -------------------------------------------------------------------------------- /taskbank/tools/download_model.sh: -------------------------------------------------------------------------------- 1 | ##!/usr/bin/env bash 2 | 3 | CURRDIR=$(pwd) 4 | BASEDIR=$(dirname "$0") 5 | 6 | TASKS="autoencoder \ 7 | class_1000 \ 8 | class_places \ 9 | colorization \ 10 | curvature \ 11 | denoise \ 12 | edge2d \ 13 | edge3d \ 14 | inpainting_whole \ 15 | jigsaw \ 16 | keypoint2d \ 17 | keypoint3d \ 18 | reshade \ 19 | rgb2depth \ 20 | rgb2mist \ 21 | rgb2sfnorm \ 22 | room_layout \ 23 | segment25d \ 24 | segment2d \ 25 | segmentsemantic \ 26 | vanishing_point" 27 | mkdir -p "$CURRDIR/$BASEDIR/../temp" 28 | 29 | SUBFIX="data-00000-of-00001 meta index" 30 | 31 | for t in $TASKS; do 32 | mkdir -p "$CURRDIR/$BASEDIR/../temp/${t}" 33 | for s in $SUBFIX; do 34 | echo "Downloading ${t}'s model.${s}" 35 | wget "http://downloads.cs.stanford.edu/downloads/taskonomy_taskbankv1_models/${t}/model.permanent-ckpt.${s}" -P $CURRDIR/$BASEDIR/../temp/${t} 36 | done 37 | done 38 | -------------------------------------------------------------------------------- /taskbank/tools/download_model_multi.sh: -------------------------------------------------------------------------------- 1 | ##!/usr/bin/env bash 2 | 3 | CURRDIR=$(pwd) 4 | BASEDIR=$(dirname "$0") 5 | 6 | TASKS="ego_motion \ 7 | fix_pose \ 8 | non_fixated_pose \ 9 | point_match" 10 | mkdir -p "$CURRDIR/$BASEDIR/../temp" 11 | 12 | SUBFIX="data-00000-of-00001 meta index" 13 | 14 | for t in $TASKS; do 15 | mkdir -p "$CURRDIR/$BASEDIR/../temp/${t}" 16 | for s in $SUBFIX; do 17 | echo "Downloading ${t}'s model.${s}" 18 | wget "http://downloads.cs.stanford.edu/downloads/taskonomy_taskbankv1_models/${t}/model.permanent-ckpt.${s}" -P $CURRDIR/$BASEDIR/../temp/${t} 19 | done 20 | done 21 | -------------------------------------------------------------------------------- /taskbank/tools/init_paths.py: -------------------------------------------------------------------------------- 1 | import os.path as osp 2 | import sys 3 | 4 | cur_dir = osp.dirname( __file__ ) 5 | # Search lib first 6 | lib_path = osp.join( cur_dir, '..', 'lib' ) 7 | sys.path.insert( 0, lib_path ) 8 | 9 | # Then elsewhere 10 | root_path = osp.join( cur_dir, '..' ) 11 | sys.path.insert( 1, root_path ) -------------------------------------------------------------------------------- /taskbank/tools/task_dict.txt: -------------------------------------------------------------------------------- 1 | Autoencoder : autoencoder 2 | Curvatures : curvature 3 | Colorization : colorization 4 | Denoising-Autoencoder : denoise 5 | Depth : rgb2depth 6 | Edge-2D : edge2d 7 | Edge-3D : edge3d 8 | Euclidean-Distance : rgb2mist 9 | Inpainting : inpainting_whole 10 | Jigsaw-Puzzle : jigsaw 11 | Keypoint-2D : keypoint2d 12 | Keypoint-3D : keypoint3d 13 | Object-Classification : class_1000 14 | Reshading : reshade 15 | Room-Layout :room_layout 16 | Scene-Classification : class_places 17 | Segmentation-2D : segment2d 18 | Segmentation-3D : segment25d 19 | Segmentation-Semantic : segmentsemantic 20 | Surface-Normal : rgb2sfnorm 21 | Vanishing-Point : vanishing_point 22 | Pairwise-Nonfixated-Camera-Pose : non_fixated_pose 23 | Pairwise-Fixated-Camera-Pose : fix_pose 24 | Triplet-Fixated-Camera-Pose : ego_motion 25 | Point-Matching : point_match 26 | --------------------------------------------------------------------------------