GithubHelp home page GithubHelp logo

Comments (8)

him4318 avatar him4318 commented on June 12, 2024 1

Sorry closed it by mistake you can re-open it.

from transformer-ocr.

him4318 avatar him4318 commented on June 12, 2024

Hi,
Can you check your data loader, this is with it only instead of text it is getting arrays.

from transformer-ocr.

corbinan avatar corbinan commented on June 12, 2024

Hi thanks, what should I change?

from transformer-ocr.

him4318 avatar him4318 commented on June 12, 2024

You can try to put print statement in the get_item function of data loader.

    def __getitem__(self, i):
        img = self.dataset[self.split]['dt'][i]
        
        #making image compatible with resnet
        img = np.repeat(img[..., np.newaxis],3, -1)    
        img = pp.normalization(img)
        
        if self.transform is not None:
            img = self.transform(img)

        ###Here
        ###if it's array then change it accordingly in the code.
        print(self.dataset[self.split]['gt'][i])


        y_train = self.tokenizer.encode(self.dataset[self.split]['gt'][i]) 
        
        #padding till max length
        y_train = np.pad(y_train, (0, self.tokenizer.maxlen - len(y_train)))

        gt = torch.Tensor(y_train)

        return img, gt          

    def __len__(self):
      return self.size

from transformer-ocr.

corbinan avatar corbinan commented on June 12, 2024

Did that, it has printed an array of numbers

image

How do I fix this in the data loader?

from transformer-ocr.

him4318 avatar him4318 commented on June 12, 2024

So it seems there is a problem with hdf5 itself, while creating it you have saved the integer values instead of text.

from transformer-ocr.

corbinan avatar corbinan commented on June 12, 2024

I had run it like this:

python3 main.py --source=bentham --transform

from transformer-ocr.

corbinan avatar corbinan commented on June 12, 2024

Ran it again and this time I got this:

normalize() argument 2 must be str, not numpy.bytes_

From printing like you asked me to above, I get this:

image

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.