Comments (7)
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.
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.
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.
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.
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.
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.
It seems is the hdf5 file. I'll be handling all of it directly with opencv.
Thanks.
from transformer-ocr.
Related Issues (19)
- LR and loss HOT 1
- Different dataset HOT 1
- Sain Gall and Washington links doesnt work HOT 1
- TypeError: iteration over a 0-d tensor HOT 6
- Google Colab link HOT 1
- Need help
- Question regarding error metrics/dataset creation HOT 1
- The link of 'Rimes' dataset can't be opened. Can you share it in some other way? Thansk! HOT 1
- Dataset Links
- AttributeError: 'numpy.ndarray' object has no attribute 'decode' HOT 1
- TypeError: normalize() argument 2 must be str, not numpy.ndarray HOT 8
- Rimes Dataset Access HOT 1
- Using my own dataset to run prediction HOT 8
- Notebook loading error HOT 3
- RuntimeError: shape '[-1, 100]' is invalid for input of size 201168 HOT 1
- Invalid argument:Not enough time for target transition sequence
- how to replace the training process of CNN(resnet101) with a pretrained one ? HOT 5
- Low performance when training your model on RWTH split on IAM HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transformer-ocr.