Comments (8)
you have to evaluate the output of the RNN with softmax applied, and then feed this into the decoder. Something like that (not tested):
- After this line, define a new variable self.rnn_out_sm = tf.nn.softmax(self.ctcIn3dTBC, axis=2)
- In the infer function, evaluate the variable defined before, rnn_out_sm_numpy = self.sess.run(self.rnn_out_sm, feedDict)
- Create the word beam search object only once! So e.g. in the
__init__
function of the Model - Then, feed the evaluated numpy array (rnn_out_sm_numpy) to the compute function
from ctcwordbeamsearch.
Step-1 Initialize above in init of Model.py
chars = str().join(self.charList) wordChars = open('../model/wordCharList.txt').read().splitlines()[0]
corpus = open('../data/corpus.txt').read() self.wbs=WordBeamSearch(25,'Words',0.0,corpus.encode('utf8'), chars.encode('utf8'), wordChars.encode('utf8'))
Step-2 in Model.py--> setupCTC() defined Point-1 Above
self.rnn_out_sm = tf.nn.softmax(self.ctcIn3dTBC, axis=2)
- Commented everything from L128-L138
Step-3-
In inferBtach() - Commented Line-250 and Line-251 , Line-254, Line-255
- Added
self.rnn_out_sm_numpy = self.sess.run(self.rnn_out_sm, feedDict) evalRes=self.wbs.compute(self.rnn_out_sm_numpy)
after Line-252
Result- On running my program in debugging mode my ctcOutput array of Line 186 is [64,61,72,72,64,57]
Observation-1 I did not get any label index as blank Line196 in my ctcOutput
Observation-2 on manually finding out the index of ctcOut array in charList i have "mjuumf" instead of "little"
Sidenote- I am running code as(python main.py --wordbeamsearch) (using presaved model ,testing on a single image)
Kindly let me know what i am doing wrong if possible, i know i am messing things up ,a word of help still highly appreciated
I am getting the error on simply running the code after making changes in model,py -- int' object is not iterable -- on Line 196
Modified model.py I have uploaded on my git just for time being after that i will remove , I have also given your reference while uploading model.py
from ctcwordbeamsearch.
Thanks again for your earlier response sir
from ctcwordbeamsearch.
Hi,
at first sight code looks OK. I guess this line is wrong and can be removed (you want to pass all batch elements to the function decoderOutputToText and not just the one with index 0):
https://github.com/jjsr/SimpleHtr/blob/main/Model.py#L273
If this does not fix the problem: can you upload all of your code into your repository? So that I just have to download it and run it to reprocude the error.
from ctcwordbeamsearch.
Sir ,After your input I am able to somehow run it on "Word" , I am not quite confident in what patches i have made during the process is right or Its really worked , Beside it Sir may you please suggest into line segmentation(Breaking a page into lines ) approach ? (The approach you think would work best on IAM(Not quite complex scenario) with preferable code implementation link). Additionally I will upload the codes of the patches i try to work out , Kindly go through it sir once uploaded . Thanks again for your timely valuable feedbacks
from ctcwordbeamsearch.
you can try WordDetectorNN to detect handwritten words on a scanned page.
from ctcwordbeamsearch.
FYI: SimpleHTR is now using the Python package (numpy operation) instead of the TF operation.
from ctcwordbeamsearch.
from ctcwordbeamsearch.
Related Issues (20)
- #Issue in running Custom TF operation HOT 4
- The Session graph is empty. Add operations to the graph before calling run(). HOT 1
- Result of Paper published HOT 2
- ./buildTF.sh giving compile errors HOT 2
- Compilation error for Mac HOT 3
- Possible to add both Word LM AND Character LM? HOT 4
- Installing ctcwordbeamsearch decoder HOT 4
- Removing the automatic use of spaces as word separators HOT 1
- Mac M1 pip3 install . HOT 6
- CTC word beam search usage for word spotting HOT 1
- What version of gcc is used HOT 4
- Unable to Install HOT 3
- Dictionary and text corpus HOT 2
- ValueError: the number of characters (chars) plus 1 must equal dimension 2 of the input tensor (mat) HOT 3
- ImportError : undefined symbol: _ZNSt15__ HOT 1
- Error with WordBeamSearch after cloning the repo and installing dependencies HOT 1
- error: subprocess-exited-with-error HOT 4
- Python version HOT 9
- Implementing Word beam search correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctcwordbeamsearch.