Facial-Expression-Recognition
Facial-Expression-Recognition copied to clipboard
NameError: name 'flags' is not defined
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
Has this problem been solved?
no, I have been waiting for your help.
Have you modified the code?
Check if the 5th line of main.py is flags = tf.app.flags
.
i have not changed any code. Here is the copy paste of 5th line
flags = tf.app.flags
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()
above is a copy paste of the entire main.py where I have just modified the paths wherever applicable as per my directory
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')
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