Giter Site home page Giter Site logo

Comments (10)

mzaradzki avatar mzaradzki commented on May 10, 2024

Hi

The hard-coded "if False" in the notebook has to be set to True or False depending in the .mat file you downloaded from the previous text cell in the notebook:

Download from console with :
wget http://www.vlfeat.org/matconvnet/models/vgg-face.mat
Alternatively :
wget http://www.robots.ox.ac.uk/~vgg/software/vgg_face/src/vgg_face_matconvnet.tar.gz

I believe as it is (if False) it assumes you downloaded the second link: depending on the link the file is not structured the same way

If this comment does not help (let me know) I will download again the .mat file to clarify this point further

from neuralnets.

yfoo avatar yfoo commented on May 10, 2024

from neuralnets.

mzaradzki avatar mzaradzki commented on May 10, 2024

Hi,

The new bug you have is probably related to the settings in the keras.json file that is documented here;
https://keras.io/backend/

One variable that impacts the convolution tensor shapes is: "image_data_format"
What value does it have in your configuration ?

When I wrote this notebook I think I used "th" (legacy values) for it as I also used Theano. Anyway it is easy to translate from one value to another one as this is just about permuting the dimension orders.

This is a point I needs to clarify in the documentation cells of the notebook to facilitates replication !

In the Keras help link above you will find function "set_image_dim_ordering" that should tweak it without changing the Json file.

If you dont manage to fix it with this function I will run it with your settings to see.

from neuralnets.

yfoo avatar yfoo commented on May 10, 2024

from neuralnets.

yfoo avatar yfoo commented on May 10, 2024

from neuralnets.

mzaradzki avatar mzaradzki commented on May 10, 2024

Ok, great, we are on the right track!

It needs something like the following (A) or (B) at the beginning of the notebook:

A)

from keras import backend as K
K.set_image_data_format( 'channels_first' )

B)

from keras import backend as K
K.set_image_dim_ordering( 'th' )

Reading the doc I think the 2 things are equivalent but that (A) is the most recent version

from neuralnets.

yfoo avatar yfoo commented on May 10, 2024

from neuralnets.

mzaradzki avatar mzaradzki commented on May 10, 2024

I just debugged it running Keras 2, TensorFlow and "image_data_format":"channels_last"

Code has been pushed on Git repo.

The last bug you had came from the fact the Input tensor was potentially not ordered the right way depending on the "image_data_format" value at this line:
mdl.add( Permute((1,2,3), input_shape=(224,224,3)) ) # WARNING : 0 is the sample dim

Similarly in "copy_mat_to_keras" function there was a potential axis ordering issue.
As well as in "pred" function.

So I added the necessary information and code changes.

I used your default value for "image_data_format":"channels_last" as it seems to be more common.

Also if you use Keras 1 in "convblock" and "vgg_face_blank" functions I left as comments the Conv2D syntax.

from neuralnets.

yfoo avatar yfoo commented on May 10, 2024

from neuralnets.

yfoo avatar yfoo commented on May 10, 2024

from neuralnets.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.