Hey guys~ I’m using tensorflow (in docker for windows) to make a picture classifier for scientific research.
I could make it successfully retrained with my own pictures, the next step is to know more about the features extracted from the pictures.
This is the command I used for retraining from a github project.
The content in retrain.py is:
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
r"""Simple transfer learning with Inception v3 or Mobilenet models.
With support for TensorBoard.
This example shows how to take a Inception v3 or Mobilenet model trained on
ImageNet images, and train a new top layer that can recognize other classes of
The top layer receives as input a 2048-dimensional vector (1001-dimensional for
Mobilenet) for each image. We train a softmax layer on top of this
representation. Assuming the softmax layer contains N labels, this corresponds
to learning N + 2048N (or 1001N) model parameters corresponding to the
learned biases and weights.
Here’s an example, which assumes you have a folder containing class-named
subfolders, each full of images for each label. The example folder flower_photos
should have a structure like this:
The subfolder names are important, since they define what label is applied to
each image, but the filenames themselves don’t matter. Once your images are
prepared, you can run the training with a command like this:
bazel build tensorflow/examples/image_retraining:retrain && \ bazel-bin/tensorflow/examples/image_retraining/retrain \ --image_dir ~/flower_photos
Or, if you have a pip installation of tensorflow,
retrain.py can be run
python tensorflow/examples/image_retraining/retrain.py \ --image_dir ~/flower_photos
You can replace the image_dir argument with any folder containing subfolders of
images. The label for each image is taken from the name of the subfolder it’s
Looks like there’re 2 output files and 1 folder of intermediate files after retraining:
The output ‘bottleneck’ folder contains data calculated from each input picture, but what I want is the general features from a labeled folder of pictures, not individual ones.
‘retrained_labels.txt’ contains … ‘label’ I gave to each folder.
‘retrained_graph.pb’ is the ‘output graph’ defined in the script,
Is the pb containing the output information of each class? Why I ask this is because I cannot not read it using vim and is there other file I don’t know?
I’m still new to linux but I’m trying to learn, so anyone knows about it, please give your suggestion.