{"id":13586701,"url":"https://github.com/Geoyi/pixel-decoder","last_synced_at":"2025-04-07T18:34:38.960Z","repository":{"id":39738740,"uuid":"144593839","full_name":"Geoyi/pixel-decoder","owner":"Geoyi","description":"A tool for running deep learning algorithms for semantic segmentation with satellite imagery","archived":false,"fork":false,"pushed_at":"2023-03-24T23:38:07.000Z","size":2966,"stargazers_count":78,"open_issues_count":4,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-02T16:04:16.773Z","etag":null,"topics":["computervision","deep-learning","encoder-decoder","label-maker","labelmaker","nerual-network","nvidia-docker","pixel-decoder","satellite-imagery","segmentation","unet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Geoyi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-08-13T14:48:51.000Z","updated_at":"2024-04-04T02:22:37.000Z","dependencies_parsed_at":"2023-09-22T07:05:53.458Z","dependency_job_id":"3bde7cbe-2140-4199-a763-5961d5609a8a","html_url":"https://github.com/Geoyi/pixel-decoder","commit_stats":{"total_commits":69,"total_committers":4,"mean_commits":17.25,"dds":0.07246376811594202,"last_synced_commit":"470c3373d183996f929e7a2a48e3df3634a4f589"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geoyi%2Fpixel-decoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geoyi%2Fpixel-decoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geoyi%2Fpixel-decoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Geoyi%2Fpixel-decoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Geoyi","download_url":"https://codeload.github.com/Geoyi/pixel-decoder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223290180,"owners_count":17120860,"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":["computervision","deep-learning","encoder-decoder","label-maker","labelmaker","nerual-network","nvidia-docker","pixel-decoder","satellite-imagery","segmentation","unet"],"created_at":"2024-08-01T15:05:45.212Z","updated_at":"2024-11-06T05:30:32.561Z","avatar_url":"https://github.com/Geoyi.png","language":"Python","readme":"# Pixel Decoder\n\n![computervision](https://user-images.githubusercontent.com/14057932/37719364-3e953da0-2cfb-11e8-8140-f5f12bb806d9.png)\nIn **computer vision**, there are three challenges: image classification, object detection and **semantic segmentation**. As you see above, semantic segmentation can segment an image into different parts and objects (e.g.grass, cat, tree, sky).\n\nPixel Decoder is a tool that contains several current available semantic segmentation algorithms. **Pixel Decoder** includes Standard Unet and its modified versions, Tiramisu and SegNet. SegNet is the algorithm that Skynet was built on. All the algorithms that live inside Pixel Decoder are convolutional neural networks are all in a structure that called encoder-decoder.\n![encoder-decoder](https://user-images.githubusercontent.com/14057932/37719742-14b23582-2cfc-11e8-8242-a3773df31bc2.png)\nThe encoder reads in the image pixels and compresses the information in vector, downsample to save computing memory; and the decoder works on reconstructing the pixels spatial information and output the desired outcome. Some UNet-like algorithms were adopted from SpaceNet challenge solutions.\n\nAll these algorithms are built with Tensorflow and Keras. These are some results for road segmentation from Pixel Decoder we got.\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"result_showcase/TZ_road_out.png\" width=\"1000\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"result_showcase/TZ_road_out1.png\" width=\"1000\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"result_showcase/TZ_road_out3.png\" width=\"1000\" /\u003e\n\u003c/p\u003e\n### Installation\n\n```bash\ngit clone https://github.com/Geoyi/pixel-decoder\ncd pixel-decoder\npip install -e .\n```\n\n### Train\n\n```bash\npixel_decoder train --batch_size=4 \\\n                    --imgs_folder=tiles \\\n                    --masks_folder=labels \\\n                    --models_folder=trained_models_out \\\n                    --model_id=resnet_unet \\\n                    --origin_shape_no=256 \\\n                    --border_no=32\n```\nIt takes in the training dataset that created from [`Label Maker`](https://github.com/developmentseed/label-maker).\n\n\n- `batch_size`: batch size for the training;\n- `imgs_folder`: is the directory for RGB images to train;\n- `masks_folder`: is the directory for labeled mask to train;\n- `model_id`: is the neural net architecture to train with. We have - `resnet_unet`, `inception_unet`, `linknet_unet`, `SegNet`, `Tiramisu` as model_id live in **Pixel Decoder**.\n- `origin_shape_no`: 256 is the default image tile shape from [Label Maker](https://github.com/developmentseed/label-maker);\n- `border_no`: it's set to 32. It's a additional 32 pixel to add on 256 by 256 image tile to become 320 by 320 to get rid of U-Net's edge distortion.\n\n\n### Predict\nAfter the model is trained and you see a trained model weight in your model directory, run:\n\n\n```bash\npixel_decoder predict --imgs_folder=tiles \\\n                    --test_folder=test_images \\\n                    --models_folder=trained_models_out \\\n                    --pred_folder=predictions \\\n                    --model_id=resnet_unet \\\n                    --origin_shape_no=256 \\  \n                    --border_no=32\n```\n\n- `imgs_folder`: is the directory for RGB images to train;\n- `masks_folder`: is the directory for labeled mask to train. It uses to get the stats, e.g. mean and standard deviation, from training images.\n- `test_folder`: is the directory for test images.\n- `pred_folder`: a directory that saved all the predicted test image from test_folder;\n- `model_id`: is the neural net architecture to train with. We have - `resnet_unet`, `inception_unet`, `linknet_unet`, `SegNet`, `Tiramisu` as model_id live in **Pixel Decoder**.\n- `origin_shape_no`: 256 is the default image tile shape from [Label Maker](https://github.com/developmentseed/label-maker);\n- `border_no`: it's set to 32. It's a additional 32 pixel to add on 256 by 256 image tile to become 320 by 320 to get rid of U-Net's edge distortion.\n\n## Run Pixel Decoder on AWS Deep Learning AMI instance with **GUPs**\n\n### Install Nvidia-Docker on your instance\n- [Docker installation](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html) on AWS EC2. Instruction for Nvidia Docker installation [here](https://towardsdatascience.com/using-docker-to-set-up-a-deep-learning-environment-on-aws-6af37a78c551).\n\n- Build provide docker image from the Dockerfile\n\n```bash\ngit clone https://github.com/Geoyi/pixel-decoder\ncd pixel-decoder\nnvidia-docker build -t pixel_decoder .\n```\n\n- Run nvidia-docker and Pixel Decoder\n\n```bash\nnvidia-docker run -v $PWD:/work -it pixel_decoder bash\n```\n\n- Install Pixel Decoder and train the model\n\n**Train**\n```bash\npixel_decoder train --batch_size=4 \\\n                    --imgs_folder=tiles \\\n                    --masks_folder=labels \\\n                    --models_folder=trained_models_out \\\n                    --model_id=resnet_unet \\\n                    --origin_shape_no=256 \\\n                    --border_no=32\n```\n\n**Predict**\n\n```bash\npixel_decoder predict --imgs_folder=tiles \\\n                    --test_folder=test_images \\\n                    --models_folder=trained_models_out \\\n                    --pred_folder=predictions \\\n                    --model_id=resnet_unet \\\n                    --origin_shape_no=256 \\  \n                    --border_no=32\n```\n\n## About\nTo run a neural net, e.g `resnet_unet`, you can create ready-to-train dataset from [Label Maker](https://github.com/developmentseed/label-maker). A detail walkthrough notebook will come soon.\npixel_decoder was built on top of python-seed that created by [Development Seed](\u003chttp://developmentseed.org\u003e).\n","funding_links":[],"categories":["Python","Deep Learning"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeoyi%2Fpixel-decoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGeoyi%2Fpixel-decoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGeoyi%2Fpixel-decoder/lists"}