xionghc / Facial-Expression-Recognition

Facial-Expression-Recognition in TensorFlow. Detecting faces in video and recognize the expression(emotion).
GNU General Public License v3.0
628 stars 189 forks source link

NameError: name 'flags' is not defined #36

Open gauravrajan opened 5 years ago

gauravrajan commented 5 years ago

I am using a windows 10 system. I have also installed all dependencies. on running main.py , both the command prompt as well as the python shell display the following:

C:\Users\410379\Python37\Facial-Expression-Recognition-master>python main.py Traceback (most recent call last): File "main.py", line 6, in flags.DEFINE_string('MODE', 'demo', NameError: name 'flags' is not defined

xionghc commented 5 years ago

Has this problem been solved?

gauravrajan commented 5 years ago

no, I have been waiting for your help.

xionghc commented 5 years ago

Have you modified the code?

xionghc commented 5 years ago

Check if the 5th line of main.py is flags = tf.app.flags.

gauravrajan commented 5 years ago

i have not changed any code. Here is the copy paste of 5th line

flags = tf.app.flags

gauravrajan commented 5 years ago

from demo import demo from model import train_model, valid_model import tensorflow as tf

flags = tf.app.flags flags.DEFINE_string('MODE', 'demo', 'Set program to run in different mode, include train, valid and demo.') flags.DEFINE_string('C:\Users\410379\Python37\Facial-Expression-Recognition-master\ckpt', 'C:\Users\410379\Python37\Facial-Expression-Recognition-master') flags.DEFINE_string('train_data', './data/fer2013/fer2013.csv', 'Path to training data.') flags.DEFINE_string('valid_data', './valid_sets/', 'C:\Users\410379\Python37\Facial-Expression-Recognition-master') flags.DEFINE_boolean('show_box', False, 'If true, the results will show detection box') FLAGS = flags.FLAGS

def main(): assert FLAGS.MODE in ('train', 'valid', 'demo')

if FLAGS.MODE == 'demo': demo(FLAGS.checkpoint_dir, FLAGS.show_box) elif FLAGS.MODE == 'train': train_model(FLAGS.train_data) elif FLAGS.MODE == 'valid': valid_model(FLAGS.checkpoint_dir, FLAGS.valid_data)

if name == 'main': main()

gauravrajan commented 5 years ago

above is a copy paste of the entire main.py where I have just modified the paths wherever applicable as per my directory

xionghc commented 5 years ago

Try to run the below code. Please feedback the result to me.

import tensorflow as tf
flags = tf.app.flags
flags.DEFINE_string('mode', 'demo', 'help')
print('success')
lemonmimi commented 5 years ago

Have you published relevant articles on this algorithm?Can you reply the title or link of the article if there is any?Thank you very much