# Implementing Siamese Network using Tensorflow with MNIST
<p align="center"> <img src="./result.png" width="600"> </p>
I have been interested in Siamese network. To my understanding, it is one way of dealing with weakly supervised problems. Its beauty lies in its simple scheme. It seems Siamese networks (and Triplet network) have been popularly used in many applications such as face similarity and image matching. A [web page](http://andersbll.github.io/deeppy-website/examples/) motivates me to implement a similar Siamese network using Tensorflow.
These codes here embed hand-written digits into 2D space. A loss function controls the embedding to be closer for digits in the same class and further for digits in the different classes. I borrowed visualization part from the original source with a little modification.
I keep codes simple for my personal experiments (e.g., different architectures or loss functions).
* `run.py` : nothing but a wrapper for running.
* `inference.py` : architecture and loss definition. you can modify as you want.
* `visualize.py` : for visualizing result.
You can simply run :
```bash
$ python run.py
...
step 34750: loss 0.179
step 34760: loss 0.113
step 34770: loss 0.078
...
```
This will download and extract MNIST dataset (once downloaded, it will skip downloading next time). The result will look like the image on the top. It saves an intermediate model regularly (with name `model.ckpt`) while training.
When you run `run.py`, if the file exists, you will be asked if you simply want to load it. `yes` will load the model, and show embedding result. So you can see the resulting embedding anytime (by stopping training or with a separate cmd/shell while training).
```bash
$ python run.py
We found model.ckpt file. Do you want to load it [yes/no]? yes
```
Please let me know if there are mistakes or comments. Thanks!
Youngwook Paul Kwon
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
DeepLearning_Demo-code.zip (50个子文件)
DeepLearning_Demo-code
linear_regression_use_gradient_decent
readme.md 158B
data.csv 269B
linear_regression.py 3KB
.DS_Store 6KB
distributed_tensorflow
distributed_tensorflow.py 3KB
.gitattributes 378B
Resnet
url 157B
Code
resnet.py 11KB
readme.md 91B
.idea
workspace.xml 24KB
misc.xml 209B
inspectionProfiles
profiles_settings.xml 228B
Digit_Rec_Kaggle.iml 459B
modules.xml 284B
Data
train.csv 73.18MB
test.csv 48.72MB
attention
attention_tf.py 4KB
readme.md 202B
attention_keras.py 7KB
BackPropagation
bp.py 4KB
.idea
dictionaries
shixiangfu.xml 89B
vcs.xml 180B
workspace.xml 18KB
misc.xml 437B
modules.xml 286B
DeepLearning_Demo.iml 455B
siamese_tf_mnist
readme.md 2KB
inference.py 3KB
result.png 55KB
run.py 2KB
.gitignore 58B
visualize.py 1KB
.gitignore 657B
CNN
CNN_tf_demo.py 3KB
README.md 33B
AdversarialNetworks
utils.py 93B
tests.py 6KB
competition.py 4KB
demo_gaussian_mixture.py 1KB
demo_gaussian.py 1KB
demo_normal.py 0B
gradient_descent.py 1KB
models.py 6KB
.gitignore 740B
Readme.md 139B
README.md 46B
RNN_txt_prediction_numpy_only
input.txt 1.06MB
Learning RNN.docx 100KB
min-char-rnn.py 6KB
README.md 72B
共 50 条
- 1
资源评论
MarcoPage
- 粉丝: 3360
- 资源: 4033
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Django(正反向练习)
- 实践项目-图书馆管理系统(C#.NET)
- 10Eclipse项目源码.jpg
- 大屏可视化数据课程项目
- Maven 快速入门指南:安装和配置方法详解
- STM32物信息通过MQTT协议上传云平台
- STM32物信息通过MQTT协议上传云平台
- 基于Selenium的Java爬虫实战(内含谷歌浏览器Chrom和Chromedriver版本122.0.6260.0)
- 基于Selenium的Java爬虫实战(内含谷歌浏览器Chrom和Chromedriver版本122.0.6259.0)
- 基于Selenium的Java爬虫实战(内含谷歌浏览器Chrom和Chromedriver版本122.0.6258.0)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功