{"id":17801583,"url":"https://github.com/matthias-wright/siamese_architecture","last_synced_at":"2026-05-05T05:31:04.379Z","repository":{"id":103097583,"uuid":"223585596","full_name":"matthias-wright/siamese_architecture","owner":"matthias-wright","description":"PyTorch implementation of the siamese architecture for style transfer I developed for my master's thesis.","archived":false,"fork":false,"pushed_at":"2021-05-12T11:56:21.000Z","size":28383,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T18:53:51.658Z","etag":null,"topics":["autoencoder","deep-learning","generative-adversarial-network","python","pytorch","style-transfer"],"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/matthias-wright.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":"2019-11-23T12:33:30.000Z","updated_at":"2021-05-21T21:09:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"406e8a9b-bdf5-430d-935d-747a313d773d","html_url":"https://github.com/matthias-wright/siamese_architecture","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/matthias-wright%2Fsiamese_architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthias-wright%2Fsiamese_architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthias-wright%2Fsiamese_architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matthias-wright%2Fsiamese_architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matthias-wright","download_url":"https://codeload.github.com/matthias-wright/siamese_architecture/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246752635,"owners_count":20827987,"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":["autoencoder","deep-learning","generative-adversarial-network","python","pytorch","style-transfer"],"created_at":"2024-10-27T12:38:58.186Z","updated_at":"2026-05-05T05:31:04.288Z","avatar_url":"https://github.com/matthias-wright.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Siamese Architecture for Neural Style Transfer\nThe implementation of the siamese architecture that I developed for my master's thesis.\n\n## Dependencies\n* Python 3.5.2+\n* NumPy 1.11.0+\n* PyTorch 0.4.1+\n* PIL 1.1.7+\n* Matplotlib 3.0.1+\n\n## Example\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/example.png\" width=\"500px\" title=\"Example\"\u003e\n\u003c/p\u003e\n\n## Instructions\n\n### Training\n\n```python\nimport siamese\n\ndata_photo = '...' # file path to the photograph images (RGB) folder\ndata_oil = '...' # file path to the oil images (RGB) folder\nsiam_model = siamese.Siamese(in_path_photo=data_photo,\n                             in_path_oil=data_oil, \n                             autoencoder_path='saves/autoencoders', \n                             num_epochs=100, batch_size=50,\n                             learning_rate=0.0002, \n                             recon_loss_weight=10, \n                             penalty_coef=10, verbose=True)\n                          \nsiam_model.train()\n```\n\n### Load Pretrained Model\n\n```python\nimport siamese\n\ndata_photo = '...' # file path to the photograph images (RGB) folder\ndata_oil = '...' # file path to the oil images (RGB) folder\nsiam_model = siamese.Siamese(in_path_photo=data_photo,\n                             in_path_oil=data_oil, \n                             autoencoder_path='saves/autoencoders', \n                             num_epochs=100, batch_size=50,\n                             learning_rate=0.0002, \n                             recon_loss_weight=10, \n                             penalty_coef=10, verbose=True)\n\nsiam_model.load(epoch=18, path='saves')                                 \n```\n\n### Style Transfer\n\n```python\nimport siamese\nimport util\n\nsiam_model = siamese.Siamese(autoencoder_path='saves/autoencoders')\nsiam_model.load(epoch=18, path='saves')     \n\nx_photo = util.image_to_tensor('image.jpg')\nx_oil = siam_model.translate_photo_to_oil(x_photo)\nx_oil = util.tensor_to_numpy(x_oil)\nx_oil = util.numpy_to_image(x_oil)\nx_oil.save('stylized_image.png')                                    \n```\n\n## License\nThis project is licensed under the [MIT Licence](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthias-wright%2Fsiamese_architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatthias-wright%2Fsiamese_architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatthias-wright%2Fsiamese_architecture/lists"}