{"id":19603886,"url":"https://github.com/divelab/dtn","last_synced_at":"2025-04-27T19:32:27.732Z","repository":{"id":107289554,"uuid":"92325268","full_name":"divelab/dtn","owner":"divelab","description":null,"archived":false,"fork":false,"pushed_at":"2017-11-17T21:42:00.000Z","size":8770,"stargazers_count":57,"open_issues_count":3,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T02:21:47.150Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/divelab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-24T18:44:17.000Z","updated_at":"2025-01-23T05:57:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8e2f429-2867-486d-992c-0f7e44c9a173","html_url":"https://github.com/divelab/dtn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2Fdtn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2Fdtn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2Fdtn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2Fdtn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divelab","download_url":"https://codeload.github.com/divelab/dtn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251195909,"owners_count":21550866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T09:33:26.281Z","updated_at":"2025-04-27T19:32:27.721Z","avatar_url":"https://github.com/divelab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dense Transformer Networks\n\nThis is the tensorflow implementation of our recent work, \"Dense Transformer Networks\". Please check the [paper](https://arxiv.org/abs/1705.08881) for details.\n\n## Introduction\n\nIn this work, we propose Dense Transformer Networks to apply spatial transformation to semantic prediction tasks. \nDense Transformer Networks can extract features based on irregular areas, whose shapes and sizes are based on data.\nIn the meantime, Dense Transformer Networks provide a method that efficiently restores spatial relations.\n\n## Citation\nIf using this code, please cite our paper.\n```\n@article{li2017dtn,\n  title={Dense Transformer Networks},\n  author={Jun Li and Yongjun Chen and Lei Cai and Ian Davidson and Shuiwang\nJi},\n  journal={arXiv preprint arXiv:1705.08881},\n  year={2017}\n}\n```\n\n\n## Experimental results:\nWe perform our experiment on two datasets to compare the baseline U-Net model and the proposed DTN model.\n\n1. PASCAL dataset\n\n![image](https://github.com/divelab/dtn/blob/master/results/PASCALresult.png)\nSample segmentation results on the PASCAL 2012 segmentation data set. The first and\nsecond rows are the original images and the corresponding ground truth, respectively. The third and\nfourth rows are the segmentation results of U-Net and DTN, respectively.\n\n2. SNEMI3D dataset\n\n![image](https://github.com/divelab/dtn/blob/master/results/SNEMI3Dresult.PNG)\n\n\n## Dense Transformer Networks\n\n![image](https://github.com/divelab/dtn/blob/master/results/architecture.PNG)\n\n## Configure the network\n\nAll network hyperparameters are configured in main.py.\n\n#### Training\n\nmax_epoch: how many iterations or steps to train\n\ntest_step: how many steps to perform a mini test or validation\n\nsave_step: how many steps to save the model\n\nsummary_step: how many steps to save the summary\n\nkeep_prob: dropout probability\n\n#### Validing\n\nvalid_start_epoch: start step to test a model\n\nvalid_end_epoch: end step to test a model\n\nvalid_stride_of_epoch: stride to test a model\n\n#### Data\n\ndata_dir: data directory\n\ntrain_data: h5 file for training\n\nvalid_data: h5 file for validation\n\ntest_data: h5 file for testing\n\nbatch: batch size\n\nchannel: input image channel number\n\nheight, width: height and width of input image\n\n#### Debug\n\nlogdir: where to store log\n\nmodeldir: where to store saved models\n\nsampledir: where to store predicted samples, please add a / at the end for convinience\n\nmodel_name: the name prefix of saved models\n\nreload_epoch: where to return training\n\ntest_epoch: which step to test or predict\n\nrandom_seed: random seed for tensorflow\n\n#### Network architecture\n\nnetwork_depth: how deep of the U-Net including the bottom layer\n\nclass_num: how many classes. Usually number of classes plus one for background\n\nstart_channel_num: the number of channel for the first conv layer\n\n\nconv_name: use which convolutional layer in decoder. We have conv2d for standard convolutional layer, and ipixel_cl for input pixel convolutional layer proposed in our paper.\n\ndeconv_name: use which upsampling layer in decoder. We have deconv for standard deconvolutional layer, ipixel_dcl for input pixel deconvolutional layer, and pixel_dcl for pixel deconvolutional layer proposed in our paper.\n\n#### Dense Transformer Networks\n\nadd_dtn: add Dense Transformer Netwroks or not.\n\ndtn_location: The Dense Transformer Networks location.\n\ncontrol_points_ratio: the ratio of control_points comparing with the Dense transformer networks input size.\n\n## Training and Testing\n\n#### Start training\n\nAfter configure the network, we can start to train. Run\n```\npython main.py\n```\nThe training of a U-Net for semantic segmentation will start.\n\n#### Training process visualization\n\nWe employ tensorboard to visualize the training process.\n\n```\ntensorboard --logdir=logdir/\n```\n\nThe segmentation results including training and validation accuracies, and the prediction outputs are all available in tensorboard.\n\n#### Testing and prediction\n\nSelect a good point to test your model based on validation result.\n\nFill the valid_start_epoch, valid_end_epoch and valid_stride_of_epoch in configure. Then run\n\n```\npython main.py --action=test\n\n```\nIt will show the accuracy, loss and mean_iou at each epoch.\n\nIf you want to make some predictions, run\n\n```\npython main.py --action=predict\n\n```\nThe predicted segmentation results will be in sampledir set in main.py, colored.\n\n## Use Dense Transformer Networks \n\nIf you want to use Dense Transformer Networks, just Fill the add_dtn, dtn_location and control_points_ratio in configure function.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivelab%2Fdtn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivelab%2Fdtn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivelab%2Fdtn/lists"}