Code Monkey home page Code Monkey logo

Comments (23)

zoink avatar zoink commented on May 28, 2024 1

from eye-tracker.

hugochan avatar hugochan commented on May 28, 2024

@sathiez To test the trained model: run python itracker_adv.py -i input_data -lm saved_model

from eye-tracker.

 avatar commented on May 28, 2024

@hugochan can you please give some information about the input_data. in what format shall we provide the data. do we have to provide the data in .tar file as we downloaded or do we have to provide in raw format

from eye-tracker.

hugochan avatar hugochan commented on May 28, 2024

@youngsterali Just use the raw format which is a numpy .npz file.

from eye-tracker.

 avatar commented on May 28, 2024

@hugochan Thank you

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

Hi, Can you please explain, how to predict the position, using trained models? Thank you.

from eye-tracker.

hugochan avatar hugochan commented on May 28, 2024

@Safiullahmarwat you can get the prediction by evaluating the pred ops here

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

Thank you.
Just sorted out. this is a parameter for prediction. i meant this one.

       Predicted_Position = session.run(pred, feed_dict={eye_left: batch_val_data[0], \
                                    eye_right: batch_val_data[1], face: batch_val_data[2], \
                                    face_mask: batch_val_data[3], y: batch_val_data[4]})

you actually pointing toward a parameter, instead of exact answer, suitable for newbies (like me :P)
I think @sathiez also searched for the same answer.

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

Is it possible to share the script for dataset preparation? I want to prepare dataset from my own images? that shall be very helpful. Thanks in advance.
[Edit:] Here is the script, I think. https://github.com/gdubrg/Eye-Tracking-for-Everyone

from eye-tracker.

hugochan avatar hugochan commented on May 28, 2024

@Safiullahmarwat unfortunately, I do not have the script for dataset preparation. I used the preprocessed data shared by others. I suggest you to contact the original authors.

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

@hugochan If I want to extract the output of each layer, is there any way out? please tell me in the perspective of your code, although I know its not specific to your code. e.g if i input an image, i want to see the output of first layer.

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

@bryanhpchiang thank you. but still have bit confusion. e.g in the code iTracker_adv if I want to have an output at line 174. what will be the right way to get the out put? because i think it require a layer name, but here we dont have specific name here, right? so help please :)

from eye-tracker.

zoink avatar zoink commented on May 28, 2024

If you want the output after this line (https://github.com/hugochan/Eye-Tracker/blob/master/itracker_adv.py#L173), just change pred to left_eye in the following code.

Thank you.
Just sorted out. this is a parameter for prediction. i meant this one.

       Predicted_Position = session.run(pred, feed_dict={eye_left: batch_val_data[0], \
                                    eye_right: batch_val_data[1], face: batch_val_data[2], \
                                    face_mask: batch_val_data[3], y: batch_val_data[4]})

you actually pointing toward a parameter, instead of exact answer, suitable for newbies (like me :P)
I think @sathiez also searched for the same answer.

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

@bryanhpchiang Thank you. the problem got solved. actually tf can call layer by name and here in the code no name was used for any layer so default names were there which i extracted from the system via the code below
with tf.Session() as sess: val_ops = load_model(sess, 'pretrained_models/itracker_adv/model-23') tvars = tf.trainable_variables() tvars_vals = sess.run(tvars) f = open('file.txt', 'w') for var, val in zip(tvars, tvars_vals): f.write(var.name) f.write(str(val)) f.close()
then i got all the internal operations and then using the operation names i used the code below
lyr = tf.get_default_graph().get_tensor_by_name('operation name here e.g. Conv2D:0') lyr_output = sess.run(lyr,feed_dict={eye_left: left eye image from the loaded numpy validation data})
hence found the required images of the required layer

from eye-tracker.

IvanKwokKC avatar IvanKwokKC commented on May 28, 2024

I am a newbie. I am trying to launch it by this command:
python itracker_adv.py -i example.npz -lm pretrained_models/itracker_adv/model-23

Below is Error Message, what's wrong?

Traceback (most recent call last):
File "itracker_adv.py", line 468, in
main()
File "itracker_adv.py", line 465, in main
test(args)
File "itracker_adv.py", line 432, in test
_, val_data = load_data(args.input)
File "itracker_adv.py", line 72, in load_data
train_eye_left = npzfile["train_eye_left"]
File "C:\Users\ivan\Anaconda3\envs\face_rec\lib\site-packages\numpy\lib\npyio.py", line 262, in getitem
raise KeyError("%s is not a file in the archive" % key)
KeyError: 'train_eye_left is not a file in the archive'

from eye-tracker.

IvanKwokKC avatar IvanKwokKC commented on May 28, 2024

I am a newbie. I am trying to launch it by this command:
python itracker_adv.py -i example.npz -lm pretrained_models/itracker_adv/model-23

Below is Error Message, what's wrong?

Traceback (most recent call last):
File "itracker_adv.py", line 468, in
main()
File "itracker_adv.py", line 465, in main
test(args)
File "itracker_adv.py", line 432, in test
_, val_data = load_data(args.input)
File "itracker_adv.py", line 72, in load_data
train_eye_left = npzfile["train_eye_left"]
File "C:\Users\ivan\Anaconda3\envs\face_rec\lib\site-packages\numpy\lib\npyio.py", line 262, in getitem
raise KeyError("%s is not a file in the archive" % key)
KeyError: 'train_eye_left is not a file in the archive'

I solved it. I confuse with the input data. I downloaded the dataset and retry:
python itracker_adv.py -i eye_tracker_train_and_val.npz -lm pretrained_models/itracker_adv/model-23

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

@hugochan @bryanhpchiang I need little more help. can you please let me know how to manipulate weights of a trained model? I mean I have a trained model xyz-123 along with xyz-123.meta and checkpoint file. i wan to change the weights of layer-1/kernel#03 set to zero. dont know how to do that? any help please

from eye-tracker.

hugochan avatar hugochan commented on May 28, 2024

@hugochan @bryanhpchiang I need little more help. can you please let me know how to manipulate weights of a trained model? I mean I have a trained model xyz-123 along with xyz-123.meta and checkpoint file. i wan to change the weights of layer-1/kernel#03 set to zero. dont know how to do that? any help please

@Safiullahmarwat This is a generic question on TensorFlow. I personally don't have experience on this. Just googled a bit and found this post which you might find helpful.

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

Thank you, that helped alot.
Although I solved the issue yesterday, and I was to post my solution over here :) but this post gave me some more detailed directions. Thank you :P

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

hi @hugochan @bryanhpchiang once again help needed.
Is it possible to create other models (more than one instances) of the class? for example

def train(args):
    train_data, val_data = load_data(args.input)

    # train_size = 10
    # train_data = [each[:train_size] for each in train_data]
    # val_size = 1
    # val_data = [each[:val_size] for each in val_data]

    train_data = prepare_data(train_data)
    val_data = prepare_data(val_data)
    with tf.variable_scope("A", reuse=True) as scope:
        et = EyeTracker()
        train_loss_history, train_err_history, val_loss_history, val_err_history = et.train(train_data, val_data, \
                                            lr=args.learning_rate, \
                                            batch_size=args.batch_size, \
                                            max_epoch=args.max_epoch, \
                                            min_delta=1e-4, \
                                            patience=args.patience, \
                                            print_per_epoch=args.print_per_epoch,
                                            out_model=args.save_model)
        save some parts of the (et)
        scope.reuse_variables()
        et = EyeTracker()
        Assign some parts of previous (et) to the new one and continue training
        train_loss_history, train_err_history, val_loss_history, val_err_history = et.train(train_data, val_data, \
                                            lr=args.learning_rate, \
                                            batch_size=args.batch_size, \
                                            max_epoch=args.max_epoch, \
                                            min_delta=1e-4, \
                                            patience=args.patience, \
                                            print_per_epoch=args.print_per_epoch,
                                            out_model=args.save_model)

currently I am getting this error
"reuse=tf.AUTO_REUSE in VarScope?" % name)
ValueError: Variable conv1_eye_w does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?

from eye-tracker.

hugochan avatar hugochan commented on May 28, 2024

hi @hugochan @bryanhpchiang once again help needed.
Is it possible to create other models (more than one instances) of the class? for example

def train(args):
    train_data, val_data = load_data(args.input)

    # train_size = 10
    # train_data = [each[:train_size] for each in train_data]
    # val_size = 1
    # val_data = [each[:val_size] for each in val_data]

    train_data = prepare_data(train_data)
    val_data = prepare_data(val_data)
    with tf.variable_scope("A", reuse=True) as scope:
        et = EyeTracker()
        train_loss_history, train_err_history, val_loss_history, val_err_history = et.train(train_data, val_data, \
                                            lr=args.learning_rate, \
                                            batch_size=args.batch_size, \
                                            max_epoch=args.max_epoch, \
                                            min_delta=1e-4, \
                                            patience=args.patience, \
                                            print_per_epoch=args.print_per_epoch,
                                            out_model=args.save_model)
        save some parts of the (et)
        scope.reuse_variables()
        et = EyeTracker()
        Assign some parts of previous (et) to the new one and continue training
        train_loss_history, train_err_history, val_loss_history, val_err_history = et.train(train_data, val_data, \
                                            lr=args.learning_rate, \
                                            batch_size=args.batch_size, \
                                            max_epoch=args.max_epoch, \
                                            min_delta=1e-4, \
                                            patience=args.patience, \
                                            print_per_epoch=args.print_per_epoch,
                                            out_model=args.save_model)

currently I am getting this error
"reuse=tf.AUTO_REUSE in VarScope?" % name)
ValueError: Variable conv1_eye_w does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?

Could you explain what is the motivation for this?

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

Hmmm. working on regularization technique. like alternative to Dropout. even if you know how to resize a variable like asked here , that will be much appreciated.

from eye-tracker.

Safiullahmarwat avatar Safiullahmarwat commented on May 28, 2024

ok partially resolved. I changed the default constructor init to a member function initilaize() and passing variables, as shown below.

g = tf.Graph()
with g.as_default(): 
            et = EyeTracker()
            et.initialize(96,256,384,64,96,256,384,64) #(conv1_eye_out, conv2_eye_out, conv3_eye_out, conv4_eye_out, conv1_face_out, conv2_face_out, conv3_face_out, conv4_face_out)            
            result_temp = et.train(n_epoch, train_data, val_data, lr=args.learning_rate, batch_size=args.batch_size, max_epoch=args.max_epoch, min_delta=1e-4, patience=args.patience, print_per_epoch=args.print_per_epoch, out_model=args.save_model)

g = tf.Graph()
with g.as_default(): 
            et = EyeTracker()
            et.initialize(80,256,384,64,96,256,384,64) #(conv1_eye_out, conv2_eye_out, conv3_eye_out, conv4_eye_out, conv1_face_out, conv2_face_out, conv3_face_out, conv4_face_out)            
            result_temp = et.train(n_epoch, train_data, val_data, lr=args.learning_rate, batch_size=args.batch_size, max_epoch=args.max_epoch, min_delta=1e-4, patience=args.patience, print_per_epoch=args.print_per_epoch, out_model=args.save_model)

But I am still waiting for the tensor resize command, if any body knows how to resize a tensor, that would be great.

from eye-tracker.

Related Issues (20)

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.