Giter VIP home page Giter VIP logo

fastext's People

Contributors

flipajs avatar janmeier avatar michalbusta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastext's Issues

handwritten text segmentation characters

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

bad segmentation in /tmp/base_chars.png

hi,
running tools/segmentation.py creates /tmp/base_chars.png:

  • i was not able to determine where exactly in code it is created
  • i guess it contains the resulted segmentation, which is bad
  • i wonder if the bad result is due to an unfit cvBoostChar.xml
  • which API should i use to recreate cvBoostChar.xml myself?
  • any code example for such call?

thanks!!

I got many intra-lines when I use ft.findTextLines()

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?

how to call getNormalizedLines functions

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~

Text extraction

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!

import ftext Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: dynamic module does not define init function (initftext)

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?

Text clustering

Hi,

After segment text successfully as in segmentation.py, any suggest about how to make text clustering?

Thanks!

Line Detector Issue

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

Fatal Python error: PyThreadState_Get: no current thread

Hi, I am on macOS 10.14, not sure why I am getting the error after building it without problems. What I did:

  • installed opencv from brew
  • built it without much changes: cmake -D CMAKE_BUILD_TYPE=Release ..
  • copied ftext.dylib to tools and made a symlink i.e. ln -s ftext.dylib ftext.so
  • ran the segmentation script and all I get is:
/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

edge threshold

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!

M_PI_2 undefined (Visual Studio 2017)

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.

cvBoostChar.xml file

Hi Michal!
Is there any description how to train the classifier?
Or the only option is to carefully analyze the code?

Best regards
Artur

Could not find "3.4. Text Clustering" in code

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

KeyPoint question

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.

which version is the opencv need?

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);

Question about segmenter.cpp

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?

Input array is not a valid matrix in function cvPointSeqFromMat

Hello,

I am trying to debug the project on ICDAR 2013 dataset. When I run the project, the project exits with code 134 (interrupted by signal 6: SIGABRT) with following error

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:

  1. First, I tried to run the project with default parameters
    int edgeThreshold = 12;
    int kMin = 9;
    int kMax = 11;
  2. Then I changed the parameters as followed:
    int edgeThreshold = 13;
    int kMin = 4;
    int kMax = 10;
    Changing the parameters solved the issue for few images. However, for some other images the same problem arose.

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!

Segmentation Fault

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)

how to deal with this problem?

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".

error: ‘featuresMultiChar’ was not declared in this scope

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?

Input array is not a valid matrix in function cvPointSeqFromMat

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

ImportError: dynamic module does not define init function (initftext)

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?

build problem

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

How to use in Python 3?

I compiled successfully but it says

ImportError: dynamic module does not define module export function (PyInit_ftext)

How Can i transform detector output to character?

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

A directory error

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/ .

  1. My question where I have to put my input directory. My FAST-master is present in
    /home/rituraj/Downloads
  2. Will the output directory created by the code.

Please suggest the solutions,
Regards

Bad argument (Input array is not a valid matrix) when running process_dir.exe

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

Segmentation fault

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?

No module named 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

Number of pixels in sets of SBK

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?

How to determine the value of edgeThreshold

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?

Doubts on computing keypoints

Hi Michal,

I have an input image:
input

When I compute keypoints according to article (own implementation) I receive:
ft_moja_implementacja

Buy after computing keypoints according to your original version from GitHub I receive:
ft_original

Could you please tell why these versions differ and which is better?

Android build

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.