Coder Social home page Coder Social logo

Comments (12)

kaislaribi avatar kaislaribi commented on August 27, 2024 4

@sszzy0317 here is it https://www.codepile.net/pile/N8akd162

from synthtext.

ankush-me avatar ankush-me commented on August 27, 2024

You can use any image segmentation algorithm. Skimage has several:
http://scikit-image.org/docs/dev/api/skimage.segmentation.html

from synthtext.

kaislar avatar kaislar commented on August 27, 2024

thanks, i got the segmentation. Then, in which format do you store the segmented image in the .mat file
I tried as a numpy array and i got this error when i try to execute the foodfill.py script
`
Traceback (most recent call last):
File "floodFill.py", line 132, in
process_db_parallel(base_dir)
File "floodFill.py", line 115, in process_db_parallel
for res in ucm_result:
File "/home/deep/miniconda3/envs/env_dataset/lib/python2.7/multiprocessing/pool.py", line 668, in next
raise value
AttributeError: 'numpy.int64' object has no attribute 'encode'

`

from synthtext.

ankush-me avatar ankush-me commented on August 27, 2024

Please check the format details in dset.h5

from synthtext.

kaislar avatar kaislar commented on August 27, 2024

yes, i got the segmentation and depth and added them to the dataset
i got an error :

File "/media/sf_PartageVM/Dataset/SynthText/synthgen.py", line 619, in render_text
regions = self.filter_for_placement(xyz,seg,regions)
File "/media/sf_PartageVM/Dataset/SynthText/synthgen.py", line 395, in filter_for_placement
res = get_text_placement_mask(xyz,seg==l,regions['coeff'][idx],pad=2)
File "/media/sf_PartageVM/Dataset/SynthText/synthgen.py", line 252, in get_text_placement_mask
s = rescale_frontoparallel(pts_tmp,boxR,pts[0])
File "/media/sf_PartageVM/Dataset/SynthText/synthgen.py", line 200, in rescale_frontoparallel
lt1 = np.linalg.norm(p_im[n1,:]-p_im[n0,:])
IndexError: too many indices for array

Apparently it is not detecting contours !
Here is the dataset with one new image https://ufile.io/u2fs3
if you have any idea tell me...
thank you.

from synthtext.

junedgar avatar junedgar commented on August 27, 2024

@kaislar Did you get ucm.mat by using python? I got the data of segmentation, but there may someting wrong with the format. I ran with the error below:

  File "/Users/edgar/project/pyCodes/SynthText/synthgen.py", line 626, in render_text
    regions = self.filter_for_placement(xyz,seg,regions)
  File "/Users/edgar/project/pyCodes/SynthText/synthgen.py", line 395, in filter_for_placement
    res = get_text_placement_mask(xyz,seg==l,regions['coeff'][idx],pad=2)
  File "/Users/edgar/project/pyCodes/SynthText/synthgen.py", line 243, in get_text_placement_mask
    R2d = su.unrotate2d(box.copy())
  File "/Users/edgar/project/pyCodes/SynthText/synth_utils.py", line 262, in unrotate2d
    l,R = np.linalg.eig(pts.T.dot(pts))
  File "/Users/edgar/.pyenv/versions/anaconda2-4.0.0/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 1122, in eig
    _assertFinite(a)
  File "/Users/edgar/.pyenv/versions/anaconda2-4.0.0/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 217, in _assertFinite
    raise LinAlgError("Array must not contain infs or NaNs")
LinAlgError: Array must not contain infs or NaNs

If you had solve the problem, can you share me the idea?

from synthtext.

kaislar avatar kaislar commented on August 27, 2024

i wrote a python script using slic from skimage.segmentation to perform segmentation and then i count the area of each segmented region.
So i didn't use the .mat file i created my own dataset with new images

from synthtext.

junedgar avatar junedgar commented on August 27, 2024

@kaislar
thanks for your reply .
I tried the skimage.segmentation method, but got the some error. Maybe there is something wrong with other data. I generated the depth image using the tensorflow branch of FCRN.

from synthtext.

kaislar avatar kaislar commented on August 27, 2024

For segmented image did you get the labels and areas attributes stored the database. Look to the sample database to understand how to store them

from synthtext.

sszzy0317 avatar sszzy0317 commented on August 27, 2024

@kaislar
would you share your python file for segmentation, I have trouble with using the OpenCV

from synthtext.

sszzy0317 avatar sszzy0317 commented on August 27, 2024

@kaislar THANKS, I Have built the model like
"segment = slic(img, n_segments=100, compactness=20)"
but I didn't known the meaning of the parameter of n_segments and compactness

from synthtext.

mohammedayub44 avatar mohammedayub44 commented on August 27, 2024

@kaislaribi Thanks for sharing your code snippet. It was helpful.

@ankush-me I managed to run create a dset.h5 file using custom images with homes. It returns synthetic text as expected for some images (like shown below). However for some images it is throwing error similar to what is mentioned by @kaislaribi

Screenshot from 2021-06-18 17-30-30

Stack Trace of Errors (for some of the images) -

Traceback (most recent call last):
  File "/media/mayub/OS/Users/Admin/Documents/GitHub/SynthText/synthgen.py", line 615, in render_text
    regions = self.filter_for_placement(xyz,seg,regions)
  File "/media/mayub/OS/Users/Admin/Documents/GitHub/SynthText/synthgen.py", line 391, in filter_for_placement
    res = get_text_placement_mask(xyz,seg==l,regions['coeff'][idx],pad=2)
  File "/media/mayub/OS/Users/Admin/Documents/GitHub/SynthText/synthgen.py", line 250, in get_text_placement_mask
    s = rescale_frontoparallel(pts_tmp,boxR,pts[0])
  File "/media/mayub/OS/Users/Admin/Documents/GitHub/SynthText/synthgen.py", line 200, in rescale_frontoparallel
    lt1 = np.linalg.norm(p_im[n1,:]-p_im[n0,:])
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

I'm guessing this is because it did not find any good segments ? I might be wrong.
Here is one image it threw error on.
home4

For reference, this is how the masks and segments look like for the error image:

Screenshot from 2021-06-18 17-37-49

Any specific settings I can change to accommodate these images.

Thanks in advance !

from synthtext.

Related Issues (20)

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.