Giter Site home page Giter Site logo

Comments (14)

faizan1041 avatar faizan1041 commented on May 30, 2024 1

@kwcckw this happens randomly, I modified the loop to run only once and it runs fine most of the times but throws some error randomly.

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024 1

Yes, I'm working on a PR to fix this and other issues. There is a bigger discussion happening as part of #22 around how to refactor the codebase. This branch is under active development and currently cannot be expected to work as before.

For now, if you need a working version, you can git checkout 7c6350 or an earlier commit, to go back to the repository state before the reorganization began.

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024 1

20 minutes later, I did get the error again.

It turns out that it only happens when you run the test.py script from locations other than the top-level project directory. In the PaperFactory class, there is a hardcoded path to ./paper_textures, which actually doesn't exist in the same directory as the paperfactory module, causing errors when glob tries to discover those files. Specifically, glob.glob(filePath) can return an empty list. In our case, this was being passed in to random.choice which only takes nonempty lists and fails otherwise.

To fix this, you can do one of the following:

  1. always run python src/test.py from the top-level augraphy directory, or
  2. change the PaperFactory constructor in the paper_phase declaration of augraphy/src/augraphy/default/defaultpipeline.py to reflect the fully-qualified path. For example, I can now execute the test script from anywhere on my system, after changing the constructor call there to PaperFactory(texture_path="/home/alex/work/sparkfish/code/augraphy/paper_textures")

from augraphy.

kwcckw avatar kwcckw commented on May 30, 2024

Yes, actually i'm facing similar issue as well. This issue happened after the major refactoring of the code in the last commit, so @proofconstruction could you look into this ?

from augraphy.

kwcckw avatar kwcckw commented on May 30, 2024

Thanks, then i will continue the development using the prior version until we finalized on the structure of the whole pipeline.

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

Which branch and commit of the project are you getting this error on?

from augraphy.

faizan1041 avatar faizan1041 commented on May 30, 2024

commit 2a448e4 (HEAD -> dev, origin/dev, origin/HEAD)

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

Do you have other changes that are not checked into the dev branch? When I clone the repository and checkout commit 2a448e4, I don't get this error. I do see another error, which has to do with incorrect naming in the imports. In the first post on this issue, the error message says the most recent error occurred in Augraphy/Augmentations.py at line 755, but Augmentations.py does not exist in commit 2a448e4.

from augraphy.

faizan1041 avatar faizan1041 commented on May 30, 2024

Yes, I'm working on a PR to fix this and other issues. There is a bigger discussion happening as part of #22 around how to refactor the codebase. This branch is under active development and currently cannot be expected to work as before.

For now, if you need a working version, you can git checkout 7c6350 or an earlier commit, to go back to the repository state before the reorganization began.

I tried on that commit and a few commits before but still the same.

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

If you have copied in the old Augraphy/Augmentations.py, line 755 in PaperFactory calls random.choice on self.paper_textures, which is built from files in texture_path. In the init method for PaperFactory, one of the parameters is texture_path="./paper_textures", but this is not overridden in the PaperFactory() call in Augraphy/__init__.py. It's possible that PaperFactory is trying to call random.choice on a list that's still empty, because there is no directory called ./paper_textures relative to either __init__.py or test.py. You can try changing that string to a fully-qualified directory location (for example, texture_path="/home/alex/code/augraphy/paper_textures" and see if that works.

from augraphy.

jboarman avatar jboarman commented on May 30, 2024

@faizan1041 Can you share a Colab notebook where this issue is occurring?

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

I just pushed a new series of commits that undoes a lot of changes and brings the dev branch back to the previous level of stability. You should now be able to clone a new version of the repository and run the test script as before.

Currently this does not fix the problem where PaperFactory will sometimes try to produce a paper image without having read image data in from the paper_textures directory. I will work on this next.

from augraphy.

proofconstruction avatar proofconstruction commented on May 30, 2024

Interestingly, I can no longer reproduce this error on Ubuntu 21.04.

I changed cv.waitKey(1000) to cv.waitKey(100) in src/test.py so tests would run faster, then in zsh ran the loop for i in {1..100}; do python test.py; done; - no errors occurred.

from augraphy.

kwcckw avatar kwcckw commented on May 30, 2024

To prevent the similar issue in the future, i think we can add an evaluation to check whether the paper texture is empty and return some warning:

image

from augraphy.

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.