Flutter - Google ML kit - Text Recognition - Unable to read MRZ correctly - flutter

I am working on a flutter project wherein I need to read RMZ code from passport or ID cards.
I am using google ml kit's text recognition package (google_mlkit_text_recognition) to do this job and I am able to read the RMZ code.
The trouble is, the ml kit seems to gobble up a lot of '<'s from the RMZ code and also (only) sometimes seems to be able to convert the dates from 'YYMMDD' as in the passport RMZ to 'DD/MM/YYYY'.
Due to this inconsistency, I am unable to accurately get the required elements from the RMZ code.
Is there a way to make the ml kit simply read the code and spit it out as it is, in its raw form? Or is there some other way to do this - maybe use another plugin?
In case someone asks for the code. It's a boilerplate, see below:
final textDetector = TextRecognizer();
RecognizedText recognisedText = await textDetector.processImage(inputImage)

It would be helpful if you posted an image and the relative model output, pointing out what the model is failing at. Anyways, it seems weird the model does anything more to the output than giving you what it reads block by block. Having said this, the problem might be that the model is not suited for your specific task, in which case I would go on as follows:
Switch from your current model to the other available OCR model on Ml Kit. (eg. : from V2 beta to V1 or viceversa);
Try pre-trained models from Tensorlfow Hub;
Train a pre-trained model on your specific task;
Train a model from scratch on your specific task;
Look for any cloud based service which offer a model suited for your task;
This is everything I can come up with given the limited context of your question. If you are willing to expand on your specific problem I might be able to give you more precise info.

Related

Can I save python function as .tflite?

I want to preprocess an audio file and convert it to spectrogram before inserting it to my tflite model in flutter app. is there a way I can run my preprocessing function (.py) on flutter by converting it to .tflite?
That's currently not supported. You would have to include the preprocessing steps in the model itself (as TF ops, if the ops are supported in TFLite) so that it's included in converted TFLite model, or preprocess it manually outside the model in Flutter.
Kindly close the issue / mark this as the accepted answer if your issue is resolved.

How do I make use of ILocation source and target in custom routing?

This is my sample network and idea of trying how to make a new routing instead of just the shortest path (the path i want to follow is via the pink arrows)
What am I missing here to make my predefined function work?
Fixing the basics
As explained here, you can't instantiate a Java List, because it is an interface. You can however instantiate any implementing Class of a List, for example an ArrayList.
With this in mind your code will look like this:
List<Path> myPath = new ArrayList<Path>();
myPath.add(path14);
myPath.add(path8);
myPath.add(path);
myPath.add(path1);
myPath.add(path4);
myPath.add(path13);
return myPath;
So far for the basics.
Where to go from here
To get it to consider your actual source and destination for the route planning, define both as input parameters of type ILocation in the properties of the function.
Now comes the really tricky part: writing your own or importing a routing algorithm that can give you that list of paths automatically based on criteria that you define. This is however a topic too broad for this question. The basic steps will be:
Create a graph that represents your AnyLogic path network
Solve the graph routing problem with a solving algorithm (eg. Dijkstra Algorithm), using the graph, the startpoint and the endpoint
Convert the solution you get from the solver back again to an ArrayList that you can work with in AnyLogic
You can do these steps on your own, eg. by implementing the Dijkstra Algorithm yourself, or you import into AnyLogic one of the available graph solving Java packages like JUNG or Graphhopper. In this article I explain step by step how to do so with JUNG.

Matlab converting library to model

I'm working on a script to convert a Simulink library to a plain model, meaning it can be simulated, it does not auto-lock etc.
Is there a way to do this with code aside from basically copy-pasting every single block into a new model? And if it isn't, what is the most efficient way to do the "copy-paste".
I was not able to find any clues as how to approach this problem here, or on Google, or on the official documentation or on the MathWorks forum so I'm at a loss on how to proceed.
Thank you in advance!
I don't think it's possible to convert a library to a model, but you can programmatically add library blocks to models like so:
sys = 'testModel';
new_system(sys);
open_system(sys);
add_block('Simulink/Sources/Sine Wave', [sys, '/MySineWave']);
save_system(sys);
close_system(sys);
sim(sys);
You could even use the find_system command to list all the blocks in a library and then loop through them all and create a new model for each using the above code.

Is it possible to update and use updated .ini and .ned files when Omnet++ simulation is running?

I am trying to run Omnet++ and matlab software in parallel and want them to communicate. When Omnet++ is running, I want to update the position of the node and for that I want to edit the .ned and .int files with matlab results continuously. During simulation I want to generate the result file using the updated files. I want just to update the position and don't want to add or delete any node. Please suggest me a way for proceeding?
matlab_loop
{
matlab_writes_position_in_ned_file;
delay(100ms);
}
omnet_loop
{
omnet_loads_ned_and_simulates;
//sca and vec should update;
delay(100ms);
}
Thank you.
NED and Ini files are read only during initialization of the model. You can't "read" them again after the simulation started. On the other hand, you are free to modify your parameters and create/delete modules using OMNeT++'s C++ API. What you want to achieve is basicaly: set your node position based on some calculations carried out by matlab code. The proper way to do it:
Generate C code from your matlab code.
Link that code to your OMNeT++ model
Create a new mobility model (assuming you are using INET) that is using the matlab code
What you are looking for seems to be more of a project rather than a question/problem which can be solved in Q&A site like stackoverflow.
Unfortunately, I have little understanding of matlab and V-REP to provide you a satisfactory answer. However, it seems that you will need to play around with APIs in lower levels.
As an example of coupling different simulation tools to form a simulation framework in case of need consider reading this paper and this
Also note the answer given by #Rudi. He seems to know what he is talking about.

training a new model using pascal kit

need some help on this.
Currently I am doing a project on computer vision that requires me to train a new model to detect a certain object.
In this case, I am using the system provided by P. Felzenszwalb, D. McAllester, D. Ramaman and his team => Discriminatively trained deformable part models which is implemented in Matlab.
Project webpage: http://www.cs.uchicago.edu/~pff/latent/.
However I have no idea how to direct the system to use my dataset(a collection of images and annotation) which is different from the the PASCAL datasets so as to train a new model.
By directing, I meant a line of code that allows me to change the dataset the system reads from, for training a model.
E.g.
% directory for caching models, intermediate data, and results
cachedir = ['/var/tmp/rbg/YOURPATH/' VOCyear '/'];
I tried looking at their Readme and documentation guides but they do not make any mention. Do correct me if I am wrong.
Let me know if I have not made my problem clear enough.
I tried looking at some files such as global.m but no go.
Your help is much appreciated and thanks in advance!
You can try to read pascal.m in the DPM package(voc-release5), there are similar code working on VOC2007/2010 dataset.
There are plenty of parts that need to be adapted to achieve this. For example the voc_config has to be adapted in order to read from your files.
The same with the pascal_train.m function. Depending on the images and the way you parse them, this may require quite some time to adapt this function.
Other functions to consider:
imreadx
pascal_test
pascaleval