michalbusta / fastext Goto Github PK
View Code? Open in Web Editor NEWEfficient Unconstrained Scene Text Detector
License: GNU General Public License v2.0
Efficient Unconstrained Scene Text Detector
License: GNU General Public License v2.0
handwritten text segmentation characters
is it possible to detect character handwritten digits(numbers) segmentation ?
on many cases the characters are touching each other
can it be done with FASTtext to isolate each character ?
if yes, any code sample or link will be appreciated
Hi. I' m trying to run python2.7 testLines.py
but get this:
/home/yulia/FASText Using FT detector edgeThreshold = 13, kpTypes: 3 Using PyramidSegmenter, segmDeltaInt: 1 Loading CharCls Model from: /home/yulia/FASText/cvBoostChar.xml New instance 0 with edge threshold: 13 Segmentation fault (core dumped)
How can I fix it?
hi, @MichalBusta , in my case, only horizontal text lines is needed, how can I change ur code to do this? many thanks!
Hi,
May I ask some questions related to keypoints?
I am debugging function fastext_inner_loop_12 in FASTex.cpp. I have the following questions,
1 If the keypoint type is SEK, the variable "vmin" only considers part of Pd or Pb, why?
2 The keypoint score you used is the min(abs(Ix - Ip)), right? It's different with what you said in your paper.
3 May I know the reason why you check the corner and cornerout points?
4 If the current pixel value is 164, the circle 12 pixel values are 93, 99,74,205,151,188,188,168,20,19,20,100 respectively, and the thereshold is 12, then it will be considererd as a SBK. But it contains all the three types Pb,Ps and Pd, while the paper said it should be contain only 2 types, (Pb and Ps) or (Pd and Ps).
Thanks in advance. If I am wrong, please correct me.
HI @MichalBusta
Does FASText support chinese detection?
Or Is there any way to train for chinese text?
Thank you !
hi,
running tools/segmentation.py creates /tmp/base_chars.png:
thanks!!
Hello, I think the results are impressive. However, I noticed that the library is prepared to be used on Android. Do you have documentation or a sample for the use on a mobile device?
4%] Building CXX object src/CMakeFiles/FTreader.dir/segm/flood_fill.cpp.o
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp: In function ‘int cmp::floodFill(std::vectorcmp::CvFFillSegment&, cv::InputOutputArray, cv::InputOutputArray, cv::Point, int, double, int&, long int, int, int, cv::Mat&, cv::Mat&, cv::Rect&, int&, std::unordered_map<int, int>&, std::vector&, bool, bool, int, cv::Scalar, cv::Scalar)’:
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp:468:34: error: conversion from ‘cv::Mat’ to non-scalar type ‘CvMat’ requested
CvMat c_image = _image.getMat();
^
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp:469:38: error: conversion from ‘cv::Mat’ to non-scalar type ‘CvMat’ requested
CvMat c_imageId = imageId.getMat();
^
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp:480:140: error: could not convert ‘seedPoint’ from ‘cv::Point {aka cv::Point}’ to ‘CvPoint’
floodFillC(buffer, &c_imageId, &c_image, seedPoint, channel, compCounter, loDiff, upDiff, &ccomp, threshold, maxSize, segmMap, gradFill);
^
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp: In instantiation of ‘void cmp::icvFloodGrad_CnIR(uchar*, int, uchar*, int, CvSize, CvPoint, int, CvConnectedComp*, std::vectorcmp::CvFFillSegment, long int, int, long int ()(const _Tp*, const _Tp*), cv::Mat&) [with Tp = unsigned char; uchar = unsigned char; CvSize = CvSize; CvPoint = CvPoint; CvConnectedComp = CvConnectedComp]’:
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp:411:184: required from here
/home/ubuntu/like/FASText/src/segm/flood_fill.cpp:232:23: error: no match for ‘operator=’ (operand types are ‘CvScalar’ and ‘cv::Scalar {aka cv::Scalar}’)
region->value = cv::Scalar(newVal);
Hi Michal!
Is there any description how to train the classifier?
Or the only option is to carefully analyze the code?
Best regards
Artur
error: ‘featuresMultiChar’ was not declared in this scope
createTrainDataMat(featuresMultiChar, labesMultiChar, trainingData2, labelsMat2);
^
/home/blake/cv/text/FASText/src/Python/pyFastTextG.cpp:816:40: error: ‘labesMultiChar’ was not declared in this scope
createTrainDataMat(featuresMultiChar, labesMultiChar, trainingData2, labelsMat2);
my opencv version: 2.4.13
where is createTrainDataMat defined?
when I run python testLines.py, it gives the following error.
Loading CharCls Model from: /home/bear/Desktop/study/FASText-master/cvBoostChar.xml
New instance 0 with edge threshold: 13
[[442 127 29 ..., -1 0.20491254329681396
array([388, 522, 0, 3909, 975, 464], dtype=object)]
[184 201 29 ..., 30 0.0 array([124, 1, 568, 289, 274, 43], dtype=object)]
[169 282 26 ..., -1 0.49110156297683716
array([533, 534, 154, 405, 1072, 3222, 1164, 2, 475, 68], dtype=object)]
...,
[620 381 20 ..., -1 0.28855273127555847 array([4029], dtype=object)]
[611 312 24 ..., -1 0.1930018961429596 array([4030], dtype=object)]
[630 306 8 ..., -1 0.07338782399892807 array([4031], dtype=object)]]
OpenCV Error: Bad argument (Input array is not a valid matrix) in cvPointSeqFromMat, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/utils.cpp, line 54
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/imgproc/src/utils.cpp:54: error: (-5) Input array is not a valid matrix in function cvPointSeqFromMat
When I use
lines=ft.findTextLines()
then
for i in range(lines.shape[0]):
rectn = lines[i, :]
rectn[2] += rectn[0]
rectn[3] += rectn[1];
cv2.rectangle(img,(rectn[0],rectn[1]),(rectn[2],rectn[3]), color)
cv2.imwrite('dst.jpg',img);
I got many intra lines in the pic "img", how can i remove those lines?
Hi,
After segment text successfully as in segmentation.py, any suggest about how to make text clustering?
Thanks!
Can anyone here please help me with this ?
This the output I got.
Using FT detector edgeThreshold = 13, kpTypes: 3
Using PyramidSegmenter, segmDeltaInt: 1
Loading CharCls Model from: /home/ubuntu/FASText/cvBoostChar.xml
New instance 0 with edge threshold: 13
Segmentation fault (core dumped)
Hello
I would like to test the code on an image to detect the text. How can I do please?
I have compiled the sources and tested the extraction pf the features on my image but now I would like to see the results of text detection.
Thanks!
cv::Mat strokes;
std::string imgName = outDir;
imgName += cmp::IOUtils::Basename(files[x]) + ".png";
cv::imwrite(imgName, strokes);
std::vector<string> strings;
std::vector<double> quality;
for( auto str : strings)
{
std::cout << "Found: " << str << std::endl;
}
Hi,sir. Excuse me, When I run the code, I didn't find the result of detection. Could you tell me how to detection characters?
Hello,
file /home/opencv-2.4.11/modules/imgproc/src/utils.cpp, line 54
terminate called after throwing an instance of 'cv::Exception'
what(): /home/opencv-2.4.11/modules/imgproc/src/utils.cpp:54: error: (-5) _Input array is not a valid matrix in function cvPointSeqFromMat
The error appears only for few images.
Simulation Setup:
Can anybody help me with this?
Additional Info:
When I change int kMin = 4 and int kMax = 10, execution gives same error for different images. I think this problem occurs when "regionSet.size()==0" defined in FastTextLineDetector.cpp is null. But I have no idea that why it goes empty.
Thanks!
I cannot find the ftext module (import ftext). Am i missing something? thanks....
HI @MichalBusta
Does FASText support chinese text detection?
Or Is there any way to train for chinese text?
Thank you !
Hi
I am trying to locate the part of the code that executes text clustering (Section 3.4 of your FasText paper in ICCV' 15). Could you please help pinpointing the source file and function(s) that perform this ?
Thank you
Hello, I'm trying to build the project and these errors appear. Could you help me find a resolve this problem? My system is Debian Jessie with OpenCV 2.4.9,
~FASText-master/src/Python/pyFastTextG.cpp:
In function ‘PyObject* toPython(const T&)’:
~FASText-master/src/Python/pyFastTextG.cpp:146:44: error: there are no arguments to ‘PyInt_FromLong’ that depend on a template parameter, so a declaration of ‘PyInt_FromLong’ must be available [-fpermissive]
PyObject p = PyInt_FromLong((long) input);
^
~FASText-master/src/Python/pyFastTextG.cpp:146:44: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
~FASText-master/src/Python/pyFastTextG.cpp: In function ‘void exportLetter(PyArrayObject, int&, cmp::LetterCandidate&)’:
~FASText-master/src/Python/pyFastTextG.cpp:180:53: error: ‘PyInt_FromLong’ was not declared in this scope
PyArray_SETITEM(out, ptr, PyInt_FromLong(det.bbox.x));
^
~FASText-master/src/Python/pyFastTextG.cpp: In function ‘PyArrayObject* get_keypoint_strokes(int, int)’:
~FASText-master/src/Python/pyFastTextG.cpp:326:61: error: ‘PyInt_FromLong’ was not declared in this scope
PyArray_SETITEM(out, ptr, PyInt_FromLong(it->second.first));
^
~FASText-master/src/Python/pyFastTextG.cpp:352:68: error: ‘PyInt_FromLong’ was not declared in this scope
PyArray_SETITEM(out, ptr, PyInt_FromLong(strokes[i][j]->center.x));
^
~FASText-master/src/Python/pyFastTextG.cpp: In instantiation of ‘PyObject* toPython(const T&) [with T = int; PyObject = _object]’:
~FASText-master/src/Python/pyFastTextG.cpp:165:34: required from ‘PyArrayObject* toPython(std::vector<_RealType>&, std::true_type) [with T = int; PyArrayObject = tagPyArrayObject; std::true_type = std::integral_constant<bool, true>]’
~FASText-master/src/Python/pyFastTextG.cpp:174:51: required from ‘PyArrayObject* toPython(std::vector<_RealType>&) [with T = int; PyArrayObject = tagPyArrayObject]’
~FASText-master/src/Python/pyFastTextG.cpp:200:59: required from here
~FASText-master/src/Python/pyFastTextG.cpp:146:44: error: ‘PyInt_FromLong’ was not declared in this scope
PyObject _p = PyInt_FromLong((long) input);
^
In file included from /usr/include/python2.7/numpy/ndarrayobject.h:26:0,
from /usr/include/python2.7/numpy/arrayobject.h:4,
from ~FASText-master/src/Python/pyFastTextG.h:22,
from ~FASText-master/src/Python/pyFastTextG.cpp:22:
/usr/include/python2.7/numpy/__multiarray_api.h: At global scope:
/usr/include/python2.7/numpy/__multiarray_api.h:1629:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
import_array(void)
^
src/Python/CMakeFiles/fasttext_py.dir/build.make:54: recipe for target 'src/Python/CMakeFiles/fasttext_py.dir/pyFastTextG.cpp.o' failed
make[2]: ** [src/Python/CMakeFiles/fasttext_py.dir/pyFastTextG.cpp.o] Error 1
CMakeFiles/Makefile2:166: recipe for target 'src/Python/CMakeFiles/fasttext_py.dir/all' failed
make[1]: *** [src/Python/CMakeFiles/fasttext_py.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
@MichalBusta Thank you for your hard work
How can I train and extract text-lines? I only need the cropped images of the text-lines.
when I have done with ' make all '
I moved the ftext.so to 'tools' dir,then I ran this command :
python segmentation.py 1.png
Then I got this error:
import ftext
Traceback (most recent call last):
File "", line 1, in
ImportError: dynamic module does not define init function (initftext)
My system is " OS x EI Capitan ",python version is 2.7.11
Does any one know how to solve it?
seems the local threshold in the paper is implemented as global (=13) in tools/segmentation.py:
does it indeed? if so, how much effort is required to make it locally adaptive?
thanks!
Hi, I have built the library with CMake and Visual Studio but obtained the following error:
'M_PI_2' undeclared identifier.
After some digging around, I have found the reason which is specific to Visual Studio. The math constants are not defined by default in it, see this post.
There are two possible workaroun:
1: #define _USE_MATH_DEFINES
before including cmath (not sure where it is included in this library)
or
2: in geometry.h, there is a preprocessor command to define M_PI if it is not yet defined, so a similar preprocessor command can be added:
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif
Hope it can be helpful.
I compiled successfully but it says
ImportError: dynamic module does not define module export function (PyInit_ftext)
Hello I am using ubuntu with opencv 3.1.0 after building the executables I am trying to run the toy example I am getting this error.
atul@ubuntu:~/Desktop/FASText-master/tools$ python segmentation.py ~/Desktop/1
/home/atul/Desktop/FASText-master
Traceback (most recent call last):
File "segmentation.py", line 10, in
from ft import FASTex
File "/home/atul/Desktop/FASText-master/tools/ft.py", line 19, in
import ftext
ImportError: No module named ftext
hi
I have run the program and install all the needed program. But when I run python evaluateSegmentation.py it gives the following error.
/home/rituraj/Downloads/FASText-master
Traceback (most recent call last):
File "evaluateSegmentation.py", line 599, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 35, in run_evaluation
os.mkdir(outputDir)
OSError: [Errno 2] No such file or directory: '/home/busta/tmp/evalTest/2016-06-18'
Now I understands it that it requires the ICDAR 2013 data sets. I have that one also both train and test along with gt files downloaded from http://rrc.cvc.uab.es/ .
Please suggest the solutions,
Regards
Hi ,
When the value of edgeThreshold is set too small, the program will report an error:
Error: Assertion failed (total >= 0 && (depth == CV_32F || depth == CV_32S)) in cv::convexHull,
How can I solve it?
when I have done with ' make all '
I moved the ftext.so to 'tools' dir,then I ran this command :
python segmentation.py 1.png
Then I got this error:
import ftext
Traceback (most recent call last):
File "", line 1, in
ImportError: dynamic module does not define init function (initftext)
My system is " OS x EI Capitan ",python version is 2.7.11
Does any one know how to solve it?
Hi, Michal
I try to use your code to detect Chinese text, but I just can not find how to get the detected text lines. In the code, I found getNormalizedLines function, so I wanna ask is this function the proper function that can get the detected text lines, if so, how can I call this function?
Thanks very much~
Title
Hi, I am on macOS 10.14, not sure why I am getting the error after building it without problems. What I did:
cmake -D CMAKE_BUILD_TYPE=Release ..
ftext.dylib
to tools
and made a symlink i.e. ln -s ftext.dylib ftext.so
/Users/akbar/dev/ml/FASText
Fatal Python error: PyThreadState_Get: no current thread
[1] 44305 abort python2 segmentation.py /Users/akbar/Pictures/2018-10-14\ 16.17.30.jpg
Any help is much appreciated. Thanks
CMake Warning at CMakeLists.txt:66 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
CMake Error at CMakeLists.txt:72 (if):
if given arguments:
"EQUAL" "2"
Unknown arguments specified
-- Configuring incomplete, errors occurred!
See also "/home/test/like/Fastext/FASText/Release/CMakeFiles/CMakeOutput.log".
@MichalBusta I have built it to FTreader.lib. But I don't know how to use it ? Can you help me? Thanks very much!
win8.1 64bit vs2013 cmake opencv2.4.11
Loading CharCls Model from: cvBoostChar.xml
Processing: ./input\0.jpg
Detected keypoints: 4669
Segmented: 1562/2560
OpenCV Error: Bad argument (Input array is not a valid matrix) in cvPointSeqFrom
Mat, file C:\builds\2_4_PackSlave-win64-vc12-shared\opencv\modules\imgproc\src\u
tils.cpp, line 54
Hi Michal,
Could you give some details about code after line 749 in Segmenter.cpp file?
I mean after if(!segmImg.empty()) What is that code doing?
HI!
When I try to run, testlines.py, I get this issue
OpenCV Error: Assertion failed (total >= 0 && (depth == CV_32F || depth == CV_32S)) in convexHull, file /home/burhan/cv/opencv/modules/imgproc/src/convhull.cpp, line 136
terminate called after throwing an instance of 'cv::Exception'
what(): /home/burhan/cv/opencv/modules/imgproc/src/convhull.cpp:136: error: (-215) total >= 0 && (depth == CV_32F || depth == CV_32S) in function convexHull
I'm using OPENCV 3.2.0 for Linux
Please help me solve the issue
Thanks
Burhan Ul Tayyab
Hello ,
How does compile the project on Windows?
Thank you very much!
Hello Mr.Neumann,
I am a student ,interesting in your Excellent work on FASText. Infact i am a novice in Ocr area.I run your code,and get the corresponding output .Now i dont know how to transform the output to character.Is there any public code or program which can work it out?
Please suggest the solutions,
Regards
Hi Michal,
In article it is written: "The pixel p is a SBK if there is a contiguous circle segment of at least 6 pixels which are darker (or brighter) than the pixel p ...". Which means equals or greater (>=) in my opinion. But in the text above is the sign '>', I mean Pd > 6 or Pb > 6. What is the right answer?
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.