{"id":21743659,"url":"https://github.com/albertbuchard/semantic-segmentation","last_synced_at":"2026-05-03T22:34:00.150Z","repository":{"id":79563735,"uuid":"95901288","full_name":"albertbuchard/semantic-segmentation","owner":"albertbuchard","description":"Comparison of FCN and CNN on a semantic segmentation task.","archived":false,"fork":false,"pushed_at":"2017-06-30T15:32:35.000Z","size":42220,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-27T05:26:00.214Z","etag":null,"topics":["cnn","fcn","neural-network","semantic-segmentation"],"latest_commit_sha":null,"homepage":"","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/albertbuchard.png","metadata":{"files":{"readme":"README.Rmd","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-06-30T15:27:17.000Z","updated_at":"2017-12-11T21:04:29.000Z","dependencies_parsed_at":"2023-03-21T23:02:16.000Z","dependency_job_id":null,"html_url":"https://github.com/albertbuchard/semantic-segmentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/albertbuchard/semantic-segmentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertbuchard%2Fsemantic-segmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertbuchard%2Fsemantic-segmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertbuchard%2Fsemantic-segmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertbuchard%2Fsemantic-segmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertbuchard","download_url":"https://codeload.github.com/albertbuchard/semantic-segmentation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertbuchard%2Fsemantic-segmentation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32587819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cnn","fcn","neural-network","semantic-segmentation"],"created_at":"2024-11-26T07:08:41.645Z","updated_at":"2026-05-03T22:34:00.136Z","avatar_url":"https://github.com/albertbuchard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\nauthor: \"Albert Buchard, Remy Joseph\"\ndate: \"12/22/2016\"\n---\n# Technical report\n_Two Deep Neural Network architectures to find roads in satellite images: a comparison of Convolutional versus Fully Convulational Networks in a semantic segmentation task._\nNeural networks have been studied extensively and are subject to active research in numerous fields including the dynamic field of image recognition. Using a recently released framework for machine learning called Tensor Flow, and the Keras library, this work compares the performance in semantic image segmentation of two Deep Neural Network architectures trained to discriminate roads from non-roads in satellite images. A Convolutional Neural Network using Shift-And-Stich method on 8*8 patches performed largely better (F1 = 0.86) than our Fully Convolutional Neural Network architecture (F1 = 0.56) adapted from FCN-8s and training on full sized images. We expanded our training set using random and non-random transformations. During testing, we augmented the test set in a similar fashion (8x for the CNN and 32x for the FCN) and for each image, an element-wise product of prediction maps from the extended set was used to infer predictions for each pixel. We report a final classification score of 0.862 on new data. Contrary to our initial expectations and previous work in the field, this short study is in favor of a CNN approach. However, those two models complexity being orders of magnitude apart further study is necessary to tease out the effect of fine parameter tuning from a real superiority of the network architecture. Our code is openly available on GitHub (http://www.github.com/albertbuchard/semantic-segmentation).\n\n# Description\nThis package contains two models that aim at classifying roads from satellite images: a Fully Convolutional Network, and a Convolutional Neural Network which led to the best prediction\n\n# CNN\nCNN is the model that we used for our best kaggle prediction.\nTo run this code, you need to open run_CNN.py and execute it.\nThere are two main variables to deal with: RESTORE and GENERATE.\n\n## Run the predictions\nIn case the user is interested only in reproducing the submission from the model, we advise to use the following configuration:\n\n```\nRESTORE = True\nGENERATE = True\nmodel_name = \"./model_8_50epoch_0.86.ckpt\"\nsubmission_name = 'submission_reproduce.csv'\n```\n\n### GENERATE: if set to one, generate will produce and save the images for the extended training set.\nIf this is the first time you run this code, GENERATE has to be set to 1.\nThe rotated images will be produced in a matter of minutes\n\n### RESTORE: determines whether the code is to be used to train the network or to make predictions.\nIf set to False, the network will train itself on the training set and save the model.\nIf set to True, Predictions will be made on each image of the test set as well as on the rotated versions that have to be previously generated\nOnce this is done, a post-processing step is ran and produces the submission file.\n\n## Training\nIf one is interested in running the whole pipeline, we advise to run the routines twice.\n\n```\nRESTORE = False\nGENERATE = True\nmodel_name = \"./model_8_50epoch_0.86_reproduce.ckpt\"\nsubmission_name = 'submission_reproduce.csv' # Does not matter actually on the first run\n```\n\nThen, to load the newly trained model and predict:\n\n```\nRESTORE = True\nGENERATE = False\nmodel_name = \"./model_8_50epoch_0.86_reproduce.ckpt\"\nsubmission_name = 'submission_reproduce.csv'\n```\n\n## Files\n* Training_run.py contains all the routines used in the pre-processing, the training and the testing of our neural network.\n* project2_run_win.py contains the post-processing routines.\n\n\n# FCN MODEL\nAll the code relative to the FCN model construction, training and testing is in run_FCN.py.  \nTwo arguments can be given in the terminal :\n* -p or --phase : set either to \"train\", or \"test\"\n* -m or --model : the model filename (should be of format *.h5 using KERAS)\n\n## To run training\n\nIn the terminal:\n```\n$ python run_FCN.py -p \"train\"\n```\n\nWill save the new model as \"newly\\_trained\\_fcn.h5\"\n\n## To run testing\n\nIn the terminal:\n```\n$ python run_FCN.py -p \"test\"\n```\n\nThe default model will be \"final\\_fcn\\_model.h5\"\n\nTo set a custom model :\n```\n$ python run_FCN.py -p \"test\" -m \"custom.h5\"\n```\n\n# Dependencies\n\n* Core: os, sys, getopt, gzip, urllib, warning\n* Graphic/images: matplotlib, PIL\n* Machine Learning: scipy, tensorflow, keras\n* Custom: mask_to_submission\n\n#  MCA\nYou will also find a mw_transform.py file that contains the code to perfom MCA as explained in the report.\n\nTo run the MCA on an image, simply use the function:\n```\nRidge, Star = mMCA(img,20,5)\n```\n\nRidge will contain the ridgelet version of the input image img and Star will contain its Starlet counterpart.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertbuchard%2Fsemantic-segmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertbuchard%2Fsemantic-segmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertbuchard%2Fsemantic-segmentation/lists"}