GithubHelp home page GithubHelp logo

Comments (7)

him4318 avatar him4318 commented on June 12, 2024

Hi,
Can you check if the image is able to load as NumPy array or not?
One more thing can you give the path of the images just as a simple string not with the symbol b as it converts it to bytes and checks if it solves your problem.

from transformer-ocr.

sbuitragoh avatar sbuitragoh commented on June 12, 2024

Hi,

I'll check right now the path. For some reason it saves in that way.
How can I load any image from the hdf5 file?

Edit: Apparently, the path naming thing is in the transformation to the .hdf5 file. The dataset is normal.

from transformer-ocr.

sbuitragoh avatar sbuitragoh commented on June 12, 2024

cnt.

I checked every part but can't find why there's that b in the string of the .hdf5 file.
In the dataset it's like this:
{'train': {'dt': ['./data/lines/rm_149_075_001.png', './data/lines/rm_149_075_005.png', ...},
also
type(ds.dataset['train']['dt'])
<class 'list'>
and
type(ds.dataset['train']['dt'][0])
<class 'str'>

But if I look inside the file, the string is like this:
hf[i]['dt'][0]
b'./data/lines/rm_149_075_001.png'

Sadly, still can't find a way to change it.

from transformer-ocr.

him4318 avatar him4318 commented on June 12, 2024

In the Data Generator class can you look in the __getitem__ function and check img = self.dataset[self.split]['dt'][i] this line, as this is the line where image is being read from the hdf5 file. you can print the shape of the array and see if it is properly loaded or not.

from transformer-ocr.

sbuitragoh avatar sbuitragoh commented on June 12, 2024

I guess it's not loaded correctly since img has class bytes. As I read, the hdf5 file should contain the numpy array of the image but I only have the string (who mysteriously transforms into bytes). Is it to crazy if I load the image using opencv, changing the bytes to string?

from transformer-ocr.

him4318 avatar him4318 commented on June 12, 2024

There is no need to create hdf5 file if it is creating issue for you. You can directly read an image using open CV and perform same pre-processing on it and send it to generator. For pre-processing step you can look at Single_inference_image function in engine.py to get some idea.

from transformer-ocr.

sbuitragoh avatar sbuitragoh commented on June 12, 2024

It seems is the hdf5 file. I'll be handling all of it directly with opencv.
Thanks.

from transformer-ocr.

Related Issues (19)

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.