Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A directory error #8

Open
riturajsoni opened this issue Jun 18, 2016 · 28 comments
Open

A directory error #8

riturajsoni opened this issue Jun 18, 2016 · 28 comments

Comments

@riturajsoni
Copy link

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

@riturajsoni
Copy link
Author

What is the OSError :[ error no.2 coming

@MichalBusta
Copy link
Owner

Hello,

On 06/18/2016 12:54 PM, riturajsoni wrote:

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)

just modify outputBase or outputDir variable, to any directory you like.

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

the expected input directory is in var inputDir.
The code expect:
- in input directory .jpg, gt_.txt files from icdar 2013 dataset
- subdirectory "segmentations" with corresponding segmentations
from text segmentation challenge.

  1. Will the output directory created by the code.

yes.

All the best, Michal

Please suggest the solutions,
Regards


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#8, or mute the thread
https://github.com/notifications/unsubscribe/AD6jsE4OXULmqQv_8TCD-zSPrhU9byt6ks5qM85qgaJpZM4I47DO.

@riturajsoni
Copy link
Author

thanks for the reply
I did this with following files in the path

  1. Input files : /textspotter/evaluation-sets/icdar2013-Test/img_1.jpg
  2. gt files in : /textspotter/evaluation-sets/icdar2013-Test/segmentations/img_1_GT.txt
  3. .png files in : /textspotter/evaluation-sets/icdar2013-Test/segmentations/gt_img_1.png

The code all the files perfectly but a error occurs
which is attached ..here the error

octaves = np.unique( letterInside[:, 2])

IndexError: too many indices

My question : What is this error. Am i placing the files in right folder becos thats what i understand from the code that it will get the gt file and then try to locate the .bmp files or .png files.
please suggest the solution
results

@MichalBusta
Copy link
Owner

You can go to debug mode or print the content of

|letterInside, lettersInside.shape|

On 06/22/2016 08:09 AM, riturajsoni wrote:

thanks for the reply
I did this with following files in the path

  1. Input files : /textspotter/evaluation-sets/icdar2013-Test/img_1.jpg
  2. gt files in :
    /textspotter/evaluation-sets/icdar2013-Test/segmentations/img_1_GT.txt
  3. .png files in :
    /textspotter/evaluation-sets/icdar2013-Test/segmentations/gt_img_1.png

The code all the files perfectly but a error occurs
which is attached ..here the error

|octaves = np.unique( letterInside[:, 2]) |

IndexError: too many indices

My question : What is this error. Am i placing the files in right
folder becos thats what i understand from the code that it will get
the gt file and then try to locate the .bmp files or .png files.
please suggest the solution
results
https://cloud.githubusercontent.com/assets/16069242/16256165/ac7457a4-386d-11e6-85f9-b85652f6be45.png


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsBQtwmvz_zno1lApS8NSUi8AIEoHks5qONF-gaJpZM4I47DO.

@riturajsoni
Copy link
Author

Hi michal
I did that it is printing

  1. print letterInside
    [ 466.94403076 131.07200623 3. 137. -153.43495178
    466.94403076 139.26400757 458.75201416 126.97600555 1. 1.
    0. ]
  2. print letterInside.shape
    (12,)

what does it mean...
thanks for the reply

@riturajsoni
Copy link
Author

The letterInside seems to be single dimenson array therfore
octaves = np.unique( letterInside[:, 2])
IndexError: too many indice

is coming .... the code get stucks here....share if you can help

@MichalBusta
Copy link
Owner

ust need simple fix may work:

  • if len(letterInside) == 1:
    letterInside = np.reshape(1, letterInside.shape[0])

On 06/22/2016 09:27 AM, riturajsoni wrote:

Hi michal
I did that it is printing

  1. print letterInside
    [ 466.94403076 131.07200623 3. 137. -153.43495178
    466.94403076 139.26400757 458.75201416 126.97600555 1. 1.
  2. ]
  3. print letterInside.shape
    (12,)

what does it mean...
thanks for the reply


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsJjXlNRlqlu2otS12eyPsz3nM-Irks5qOOPWgaJpZM4I47DO.

@riturajsoni
Copy link
Author

riturajsoni commented Jun 22, 2016

  1. len(letterInside) is coming 12 in present case...so it seems to one Dimensional matrix. What should be the size of the letterInside for the proper result.
  2. letterInside = keypointsInside[rectMask, :]
    here rectMask is coming false....

@MichalBusta
Copy link
Owner

sorry typo:
len(letterInside.shape)

On 06/22/2016 10:30 AM, riturajsoni wrote:

len(letterInside) is coming 12 in present case...so it seems to one
Dimensional matrix. What should be the size of the letterInside for
the proper result.

@riturajsoni
Copy link
Author

Thanks for suggestion although i change it a bit

  1. if len(letterInside.shape) == 1:
    letterInside = np.reshape(letterInside,(1,letterInside.shape[0])).T
    that gives the letterInside as [12,0] arrangement as simply reshape giving errors and also changes the octaves = np.unique( letterInside[:, 2]) to octaves = np.unique( letterInside[:, 0]) as the 2 was still out of index.
    now the new error occurs like this
    File "evaluateSegmentation.py", line 625, in
    run_evaluation(inputDir, outputDir, process_color, processTest)
    File "evaluateSegmentation.py", line 248, in run_evaluation
    union_area = utils.area(utils.union(rectn, gt_rect))
    File "/home/rituraj/Downloads/FASText-master/tools/utils.py", line 28, in area
    width =a[2] - a[0]
    TypeError: unsupported operand type(s) for -: 'str' and 'int'
    what is happening here ...I am trying to figure out but not getting ho w to resolve it.

@MichalBusta
Copy link
Owner

On 06/22/2016 11:47 AM, riturajsoni wrote:

Thanks for suggestion although i change it a bit

  1. if len(letterInside.shape) == 1:
    letterInside = np.reshape(letterInside,(1,letterInside.shape[0])).T
    that gives the letterInside as [12,0] arrangement as simply reshape
    giving errors and also changes the octaves = np.unique(
    letterInside[:, 2]) to octaves = np.unique( letterInside[:, 0]) as the
    2 was still out of index.

the shape should be (1, 12) (one row, 12 features) ?
row if the keypoint, the cols are the keypoint features.

now the new error occurs like this
File "evaluateSegmentation.py", line 625, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 248, in run_evaluation
union_area = utils.area(utils.union(rectn, gt_rect))
File "/home/rituraj/Downloads/FASText-master/tools/utils.py", line 28,
in area
width =a[2] - a[0]
TypeError: unsupported operand type(s) for -: 'str' and 'int'
what is happening here ...I am trying to figure out but not getting ho
w to resolve it.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsHB3TE1xxUQeWFwMjO4jmANbMfEmks5qOQShgaJpZM4I47DO.

@riturajsoni
Copy link
Author

thanks i write these lines and able to get (1,12) form

  1. if len(letterInside.shape) == 1:
    letterInside = np.reshape(letterInside, (1,letterInside.shape[0]),order='C')
    print letterInside.shape

the output of last statement is (1,12)

#This is the output of the print letterInside
[[ 466.94403076 131.07200623 3. 137. -153.43495178
466.94403076 139.26400757 458.75201416 126.97600555 1. 1.

  1.    ]]
    

so now again the following error comes
File "evaluateSegmentation.py", line 626, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 249, in run_evaluation
union_area = utils.area(utils.union(rectn, gt_rect))
File "/home/rituraj/Downloads/FASText-master/tools/utils.py", line 28, in area
width =a[2] - a[0]
TypeError: unsupported operand type(s) for -: 'str' and 'int'

how to resolve this

@MichalBusta
Copy link
Owner

On 06/22/2016 12:56 PM, riturajsoni wrote:

thanks i write these lines and able to get (1,12) form

  1. if len(letterInside.shape) == 1: letterInside =
    np.reshape(letterInside, (1,letterInside.shape[0]),order='C')
    print letterInside.shape # the output of last statement is (1,12)
    #This is the output of the print letterInside [[ 466.94403076
    131.07200623 3. 137. -153.43495178 466.94403076 139.26400757
    458.75201416 126.97600555 1. 1.
    1. ]]

so now again the following error comes
File "evaluateSegmentation.py", line 626, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 249, in run_evaluation
union_area = utils.area(utils.union(rectn, gt_rect))
File "/home/rituraj/Downloads/FASText-master/tools/utils.py", line 28,
in area
width =a[2] - a[0]
TypeError: unsupported operand type(s) for -: 'str' and 'int'

what is your gt format:

38, 43, 920, 215, "Tiredness"
275, 264, 665, 450, "kills"
0, 699, 77, 830, "A"
128, 705, 483, 839, "short"
542, 710, 938, 841, "break"
87, 884, 457, 1021, "could"
517, 919, 831, 1024, "save"
166, 1095, 468, 1231, "your"
530, 1069, 743, 1206, "life"

?

how to resolve this


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsGBDIminW4GQu5Pe9HW3A14-zgThks5qORTCgaJpZM4I47DO.

@riturajsoni
Copy link
Author

yes this is the gt format and same image is taken for the experiment and i have taken this image only..for beginning once results will come i will put more in the folders. along with .jpg and gt.txt i have included .png file for it as per the code requirement.

@riturajsoni
Copy link
Author

i try to check the type of 'a' in the function utils.area it comes out be < tuple, tuple>
#def area(a):
'''Computes rectangle area'''

print type(a)       
#print a[1]
#print a[2] 
#print a[3]
a[1]=a[2] - a[0]
height=a[3] - a[1]
return width * height # 

I think the error lies here only...as tuple cannot be assigned a integer. as well as it is stated that the value of tuple cannot be changed as they are immutable objects.
Please suggest some solutions ...

@MichalBusta
Copy link
Owner

Hi,

On 06/23/2016 09:08 AM, riturajsoni wrote:

i try to check the type of 'a' in the function utils.area it comes out
be < tuple, tuple>
#def area(a):
'''Computes rectangle area'''

|print type(a) #print a[1] #print a[2] #print a[3] a[1]=a[2] - a[0]|
|the last version of github code is:

def area(a):
'''Computes rectangle area'''
width = a[2] - a[0]
height = a[3] - a[1]
return width * height

however the inputs are already bad - there should be (x, y, w, h, ....)

  • can you trace the origin of the values coming into the fnc area?

|
|

I think the error lies here only...as tuple cannot be assigned a
integer. as well as it is stated that the value of tuple cannot be
changed as they are immutable objects.
Please suggest some solutions ...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsO5K_1xWFtKfRT_kIdtjrOMJGMAkks5qOjD1gaJpZM4I47DO.

@riturajsoni
Copy link
Author

Ok I shall try those

@riturajsoni
Copy link
Author

Hi
I got it how the values are going in to the fnc area
the values are going like this

Actually the output of utils.union(rectn, gt_rect) :: (796, 791, '38,', '215,') in my example case...
and the line union_area = utils.area(utils.union(rectn, gt_rect)) calls the area function so the input to the area function is like these four parameters (796, 791, '38,', '215,') in which 796 and 791 are integers and '38', and '215', are not integers.

Same also happening in the line around 280 union_area = utils.area(utils.union(rectn, chars2Rect))

I think this '38', and '215', are to be converted in integer and it corresponds to a[2] and a[3] in the area function.
Regards

@riturajsoni
Copy link
Author

hi
I just put the following code in utls.py just before the line
gt_rectangles.append([minX, minY, maxX, maxY, splitLine[4], 0, 0] )
The code is
minX = minX.replace(',', '')
maxX = maxX.replace(',', '')
minY = minY.replace(',', '')
maxY = maxY.replace(',', '')
that solve the problem of reading 38, as '38' and further adding the follwoing lines in utils.py
width=int(a[2]) - int(a[0])
height=int(a[3]) - int(a[1])
return width * height
It therefore read the integer properly.

Now the error comes at this point
Traceback (most recent call last):
File "evaluateSegmentation.py", line 655, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 299, in run_evaluation
ratio = int_area / float(union_area)
ZeroDivisionError: float division by zero

it happens in the line r
ratio = int_area / float(union_area)

Please share if any solution is there.,

@riturajsoni riturajsoni reopened this Jun 23, 2016
@MichalBusta
Copy link
Owner

On 06/23/2016 10:19 PM, riturajsoni wrote:

hi
I just put the following code in utls.py just before the line
gt_rectangles.append([minX, minY, maxX, maxY, splitLine[4], 0, 0] )
The code is
minX = minX.replace(',', '')
maxX = maxX.replace(',', '')
minY = minY.replace(',', '')
maxY = maxY.replace(',', '')
that solve the problem of reading 38, as '38' and further adding the
follwoing lines in utils.py
width=int(a[2]) - int(a[0])
height=int(a[3]) - int(a[1])
return width * height
It therefore read the integer properly.

can you send me your gt file on image which is crashing?
there is something wrong with gt reading what I can not reproduce :I

Now the error comes at this point

Traceback (most recent call last):
File "evaluateSegmentation.py", line 655, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 299, in run_evaluation
ratio = int_area / float(union_area)
ZeroDivisionError: float division by zero

The problem is somewhere up - the union of 2 rect can not be zero ...

it happens in the line r
ratio = int_area / float(union_area)

Please share if any solution is there.,


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsMpSC-o3S-oGZDEZymSzp6Eqwy4xks5qOupcgaJpZM4I47DO.

@riturajsoni
Copy link
Author

Hi
Sorry for late reply....The file is
1- .Gt FILE
img_1_GT.txt
2. IMAGE FILE is
img_1
3. .PNG FILE IS
gt_img_1

These are the file ( only one image and its gt file and its .png file from ICDAR 2013 test set is used.)

Please check and guide me further.
Regards

@MichalBusta
Copy link
Owner

Hi,
one more check:
- in attachment there are also segmentations gt files (for
character level) - they should be located in "segmentations" subdir.
(for some reason, they are now included just on Train set in ICDAR
downloads).

Michal

On 06/25/2016 08:01 PM, riturajsoni wrote:

Hi
Sorry for late reply....The file is
1- .Gt FILE
img_1_GT.txt
https://github.com/MichalBusta/FASText/files/333206/img_1_GT.txt
2. IMAGE FILE is
img_1
https://cloud.githubusercontent.com/assets/16069242/16358287/a564261c-3b2c-11e6-89df-77424d0697fb.jpg
3. .PNG FILE IS
gt_img_1
https://cloud.githubusercontent.com/assets/16069242/16358291/b85d6daa-3b2c-11e6-8e0e-3042f6afd89a.png

These are the file ( only one image and its gt file and its .png file
from ICDAR 2013 test set is used.)

Please check and guide me further.
Regards


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsLN-3pGhSZ9LpD6DriOHMwLQCHK9ks5qPWzdgaJpZM4I47DO.

@riturajsoni
Copy link
Author

Yes the .gt files are present in the train section for character level segmentation but that are correspond to different set of images.
Please tell me which set of images( .jpg, .gt , .png ) files should be put in directories to run the code.

@MichalBusta
Copy link
Owner

https://drive.google.com/file/d/0B8SUcdkLTcuTNTY0V09uT3B1ZGM/view?usp=sharing

On 06/30/2016 06:27 AM, riturajsoni wrote:

Yes the .gt files are present in the train section for character level
segmentation but that are correspond to different set of images.
Please tell me which set of images( .jpg, .gt , .png ) files should be
put in directories to run the code.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsBO6x0R43XRzTY_-J63Z353Zkx3yks5qQ0XDgaJpZM4I47DO.

@riturajsoni
Copy link
Author

Can you please send how the result files will look like.. I am running code on the dataset shared by you..
Thanks

@riturajsoni
Copy link
Author

I have run the code on the dataset shared by you but still some issues occur like..
THE SHAPE OF THE letterInside is after changing is : (1, 12)
Traceback (most recent call last):
File "evaluateSegmentation.py", line 625, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 244, in run_evaluation
union_area = utils.area(utils.union(rectn, gt_rect))
File "/home/rituraj/Downloads/FASText-master/tools/utils.py", line 30, in area
width=a[2] - a[0]
TypeError: unsupported operand type(s) for -: 'str' and 'int'

This error is coming because of some typecasting problem... If i correct it then the following error occurs
Traceback (most recent call last): File "evaluateSegmentation.py", line 655, in run_evaluation(inputDir, outputDir, process_color, processTest) File "evaluateSegmentation.py", line 299, in run_evaluation ratio = int_area / float(union_area) ZeroDivisionError: float division by zero

Division by zero error.

I think I am trying but not able to excute this code...may be mistakes at my end.. If possible just tell me how the results ( any sample of results like graph, image anything) then possibly I can excute it.
Regards

@riturajsoni
Copy link
Author

hi any help on the above issues if you can so that ..I can proceed further

@MichalBusta
Copy link
Owner

Hi,

the results are quite simple - program will print results to the console:

r p HMean KP M.Let. M.Seg. SegC RecR
0.799 0.147 0.473 753351 85.0 772.0 259885.0 0.867

Times:

KP s c rawCls tl Wt tc
tt StrSeg GCTime
38.987 129.511002 46.236 1.876 0.0 0.169 0.0 0.0 28.399 0.0

the results are also stored in evaluation.npz

the problems you are reporting are still same - there is wrong parsing
of gt files, so I'd recommend to put assert on gt file reading,
something like:
assert type(value to check) is IntType - when assertation fails, you can
look where the wrong entry came from, and add new assert to that point,
so you can trace error quick.

P.S. sorry for delay, I have been on vacation.

On 07/04/2016 07:47 AM, riturajsoni wrote:

I have run the code on the dataset shared by you but still some issues
occur like..
THE SHAPE OF THE letterInside is after changing is : (1, 12)
Traceback (most recent call last):
File "evaluateSegmentation.py", line 625, in
run_evaluation(inputDir, outputDir, process_color, processTest)
File "evaluateSegmentation.py", line 244, in run_evaluation
union_area = utils.area(utils.union(rectn, gt_rect))
File "/home/rituraj/Downloads/FASText-master/tools/utils.py", line 30,
in area
width=a[2] - a[0]
TypeError: unsupported operand type(s) for -: 'str' and 'int'

This error is coming because of some typecasting problem... If i
correct it then the following error occurs
Traceback (most recent call last): File "evaluateSegmentation.py",
line 655, in run_evaluation(inputDir, outputDir, process_color,
processTest) File "evaluateSegmentation.py", line 299, in
run_evaluation ratio = int_area / float(union_area) ZeroDivisionError:
float division by zero

Division by zero error.

I think I am trying but not able to excute this code...may be mistakes
at my end.. If possible just tell me how the results ( any sample of
results like graph, image anything) then possibly I can excute it.
Regards


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AD6jsIG6fbdE5TBHAdoaRJ6PRaD5rLggks5qSJ52gaJpZM4I47DO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants