vikramank / deep-learning- Goto Github PK
View Code? Open in Web Editor NEWDeep learning algorithms written in TensorFlow
License: MIT License
Deep learning algorithms written in TensorFlow
License: MIT License
After solving previous problem a new problem has arrived. The problem is:
After completing 1st iteration any Browser is unable to show Total amount of accuracy depend on Testing & validation data set. For more clearance a screenshot has given:
However, when i've tried to run the same code with 10,000 number of training data set it shows low amount of accuracy (average 50-55%) which is violate the main target of the project:
By this, classifier cant do correct prediction i.e. near of 50% images gives correct result & rest are not....
Actually my target point is to run complete program without any issue. But now after solving one software issue this issue depend on software or hardware issue .... i really cant understand :( !!
Can you help me out with the code at [(https://github.com/dennybritz/cnn-text-classification-tf)] ?
I am new to tensorflow. I want to create .tflite file for the model in train.py, As you mentioned in the video It starts with making a checkpoint, save its graph file as .pbtxt, freeze it with creating .pb file and then finally converting it to .tflite which I want to obtain at last.
I run it in CPU mode with tensorflow=1.13.1.
I am able to generate both .pbtxt and .pb file successfully for the very first checkpoint, but getting error message at the tf.lite.TocoConverter.from_frozen_graph() line of my code.
# Training loop. For each batch...
for batch in batches:
x_batch, y_batch = zip(*batch)
train_step(x_batch, y_batch)
current_step = tf.train.global_step(sess, global_step)
if current_step % FLAGS.evaluate_every == 0:
print("\nEvaluation:")
dev_step(x_dev, y_dev, writer=dev_summary_writer)
print("")
if current_step % FLAGS.checkpoint_every == 0:
path = saver.save(sess, checkpoint_prefix, global_step=current_step)
tf.train.write_graph(sess.graph_def, checkpoint_dir, 'savegraph.pbtxt') #saving the model's tensorflow graph definition
freez_grph(checkpoint_dir)
inp_node = ['input_x']
out_node = ['output']
#nodes = [e.name + '=>' + e.op for e in tf.get_default_graph().as_graph_def().node if e.op in (( 'Softmax','Placeholder'))]
#print (nodes)
#converter = tf.lite.TFLiteConverter.from_session(sess, [cnn.embedded_chars_expanded], [cnn.input_y])
converter = tf.lite.TocoConverter.from_frozen_graph(checkpoint_dir+'/frozen_model_TextCNN Model.pb',inp_node, out_node)
tflite_model = converter.convert()
open("TextCNN.tflite", "wb").write(tflite_model)
exit()
print("Saved model checkpoint to {}\n".format(path))
Respected Sir,
I am trying to run the Hello World Tensorflow with android but encountered with the following error:
ValueError: Cannot feed value of shape (106,) for Tensor u'Placeholder_1:0', which has shape '(?, 3)'
Can you please help me with this?
Thank you for taking the time to consider my request.
Update: I figured out that the labels in the iris dataset I had were setosa, versicolor and virginica and not Iris-setosa, Iris-versicolor and Iris-virginica hence I had the above mentioned error. After removing the Iris- tag the error was solved.
Thank you..!!
i am running
sudo python3 keras_to_tensorflow.py --input_model=/home/deepedge/mask_rcnn-master/mask_rcnn_damage_0010.h5 --output_model=/home/deepedge/mask_rcnn-master/dent.pb
and getting error
Using TensorFlow backend.
E0619 15:22:44.379571 140399717234496 keras_to_tensorflow.py:95] Input file specified only holds the weights, and not the model definition. Save the model using model.save(filename.h5) which will contain the network architecture as well as its weights. If the model is saved using the model.save_weights(filename) function, either input_model_json or input_model_yaml flags should be set to to import the network architecture prior to loading the weights.
Check the keras documentation for more details (https://keras.io/getting-started/faq/)
Traceback (most recent call last):
File "keras_to_tensorflow.py", line 182, in
app.run(main)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "keras_to_tensorflow.py", line 128, in main
model = load_model(FLAGS.input_model, FLAGS.input_model_json, FLAGS.input_model_yaml)
File "keras_to_tensorflow.py", line 106, in load_model
raise wrong_file_err
File "keras_to_tensorflow.py", line 63, in load_model
model = keras.models.load_model(input_model_path)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 221, in _deserialize_model
model_config = f['model_config']
File "/usr/local/lib/python3.6/dist-packages/keras/utils/io_utils.py", line 302, in getitem
raise ValueError('Cannot create group in read only mode.')
ValueError: Cannot create group in read only mode.
iris.data file is missing
The path is incorrect and is not mandatory.
It worked for me this way with iris.data from other sources:
data=pd.read_csv('iris.data', names=['f1','f2','f3','f4','f5'], skiprows=1)
Hello Vikramank...... Thanks for your useful code. When i run 1st cell of importing required packages i was get a warning based on tflearn: "curses is not supported on this machine (please install/reinstall curses for an optimal experience)". However after running 1st 4 cells i've not get any kind of error. But after running 5th cell i have got an error as follows. [I've googled for "ValueError: invalid literal for int() with base 10" but there have no support/result which help me for following problem][sorry to say that i'm using HP 245 g5 laptop which have only 4GB RAM to run these codes] :
ValueError Traceback (most recent call last)
in ()
_1 #Importing data
----> 2 X_train, Y_train = image_pr_eloader(TRAIN_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True)
3 X_test, Y_test = image_preloader(TEST_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True)
4 X_val, Y_val = image_preloader(VALIDATION_DATA, image_shape=(56,56),mode='file', categorical_labels=True,normalize=True)
~\Anaconda3\lib\site-packages\tflearn-0.3.2-py3.6.egg\tflearn\data_utils.py in image_preloader(target_path, image_shape, mode, normalize, grayscale, categorical_labels, files_extension, filter_channel)
537 continue
538 images.append(l[0])
--> 539 labels.append(int(l[1]))
540
541 n_classes = np.max(labels) + 1
'Gupta/Anaconda3/PROGRAM_TO_CLASSIFY_IMAGES/Dataset_for_Cats_Dogs/train/cat.11963.jpg''
Can you help with a Decision Tree as asked bellow?
https://stackoverflow.com/questions/47203550/tensorflow-print-decision-tree
I am running your code with same dataset and getting following problem on my system. I am using Spyder in Anaconda on Winows 10.
I am not sure where i have to put the code to end the session. Please help
C:\Users\goutam.kumar\AppData\Local\Continuum\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py:1645: UserWarning: An interactive session is already active. This can cause out-of-memory errors in some cases. You must explicitly call InteractiveSession.close()
to release resources held by the other session(s).
warnings.warn('An interactive session is already active.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\tflearn\initializations.py:119: UniformUnitScaling.init (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.