Visualizing Image Feature Vectors through TensorBoard
Sometime you may want to see and show image feature vectors visually. TensorBoard is very good tool for such purpose.
This post describes how to visualize image feature vectors and image embeddings through TensorBoard
The content is different from official document TensorBoard: Embedding Visualization. Even checkpoint file is not required.
Visualizing your own image feature vectors.
- Sprite image of the input images
- Image feature extractor / Image feature vector
- Config file
- TensorFlow / TensorBoard (tensorflow:1.8.0 and tensorflow-hub:0.1.0 are used here)
I collected 2,500 animal images through Google image search. File path of the images are like
./images/img_0001.jpg — ./images/img_2500.jpg.
It is super easy to generate a sprite image using ImageMagick.
$ montage images/img_*.jpg -tile 50x50 -geometry 50x50! sprite.jpg
Simpler version is below:
Not only MobileNet v2, also other models, like Inception and Resnet, are available in TensorFlow Hub: Image Modules.
Using the script above,
feature_vecs.tsv is generated.
Run tensorboard at the directory of
$ tensorboard --logdir .
Then, go to http://localhost:6006/#projector.
PCA and t-SNE are available for the dimension reduction. Have fun!
(If you cannot see your feature space, reload the page.)