Loïs Faidherbe
Loïs Faidherbe

Reputation: 15

Is it possible to re-train a mobilenet neural network with png images?

I'm currently working on a mobilenet pre-trained network which I would like to re-train with a dataset which contains png images.

I call the retrain script as follow :

python scripts/retrain.py 
--bottleneck_dir=tf_files/bottlenecks 
--how_many_training_steps=200 
--model_dir=tf_files/models/ 
--summaries_dir=tf_files/training_summaries/"mobilenet_0.50_224"
--output_graph=tf_files/retrained_graph.pb 
--output_labels=tf_files/retrained_labels.txt 
--architecture mobilenet_0.50_224 
--image_dir=tf_files/data 

It seems like the images needs to be jpg, is it any way to work with png images instead ?

Upvotes: 0

Views: 133

Answers (1)

Gustavo Faria
Gustavo Faria

Reputation: 48

Can confirm it doesn't work with png files. I have, however, written a bash script that when placed in the same directory as the subclasses of the dataset can convert the images to jpg.

first you need to install imagemagick package by:

sudo apt-get install imagemagick

then you can run this script:

#!/bin/bash

for d in */ ; do
    cd "$d"
    for p in * ; do
        IFS='.' read -r -a array <<< "$p"
        convert "$p" "${array[0]}".jpg
    done
    cd ..
done

edit:

retrain.py does have a list with valid extensions (line 151):

extensions = ['jpg', 'jpeg', 'JPG', 'JPEG']

I didn't try to add 'png' to the list though

Upvotes: 1

Related Questions