Comments (14)
@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.
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.
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:
- always run
python src/test.py
from the top-levelaugraphy
directory, or - change the PaperFactory constructor in the
paper_phase
declaration ofaugraphy/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 toPaperFactory(texture_path="/home/alex/work/sparkfish/code/augraphy/paper_textures")
from augraphy.
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.
Thanks, then i will continue the development using the prior version until we finalized on the structure of the whole pipeline.
from augraphy.
Which branch and commit of the project are you getting this error on?
from augraphy.
commit 2a448e4 (HEAD -> dev, origin/dev, origin/HEAD)
from augraphy.
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.
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.
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.
@faizan1041 Can you share a Colab notebook where this issue is occurring?
from augraphy.
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.
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.
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:
from augraphy.
Related Issues (20)
- Callable pipeline HOT 2
- Develop Augmentations that Simulate Images Taken by Camera Phone HOT 1
- Add Pattern-based Distortion Generator HOT 6
- Add `InkShifter` Augmentation to Shift Ink Pixels Randomly and Follow Background Shadows
- Add Wrinkled, Crumpled Paper Augmentation HOT 1
- Create Utility Function for Exposing Underlying Pixel Colors
- Empty Pipeline lowers image quality HOT 12
- Add Augmentation for Shadows Cast onto Camera-Sourced Document Images HOT 1
- Create Baseline Performance Benchmark; Apply Initial Optimizations Using Numba HOT 2
- Create Example Using Dataloader for PyTorch and TensorFlow HOT 1
- Add Python 3.11 Support, Drop Python 3.7 HOT 2
- Images Broken in PyPI Listing HOT 2
- Reflected Light from Camera Flash or other Bright Sources HOT 1
- Add Color Shifting / 3D Blur Effect HOT 4
- Improve PageBorder effect HOT 1
- Add support for bounding box, keypoints and mask. HOT 1
- Add `InkColorSwap` to Replace the Color Used for Lettering in a Document HOT 1
- Add `InkMottling` Augmentation to Ensure Ink is Non-Uniform HOT 1
- Add support for image with alpha layer. HOT 1
- Color range in InkBleed is not working HOT 1
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 augraphy.