Comments (10)
Hi there, as I do not have TensorFlow currently installed on my main dev machine, I can't really add this functionality at present. However, it is something I definitely want to add, so I will take a look at doing this some time soon. I can't make any promises regarding when this might be unfortunately. That said, I'd be happy to take a look at a PR you might want to make!
from augmentor.
@benjaminbarbe If I have correctly understood your question, I guess that there is no too much difference in case of tensorflow
. At least, when you're writing a training loop by hand, like in this snippet (probably has typos, but I guess you've got the idea):
from Augmentor.Operations import RotateRange
from PIL import Image
op = RotateRange(probability=0.5, max_left_rotation=30, max_right_rotation=30)
with tf.Session() as session:
tf.global_variables_initialized().run()
for epoch in range(n_epochs):
for x_batch, y_batch in training_batches:
pil_images = [Image.fromarray(x) for x in x_batch]
augmented = op.perform_operation(pil_images)
arrays = [np.asarray(img, dtype=float) for img in augmented]
sess.run([train_op], feed_dict={x: x_batch, y: y_batch})
Probably there are some helpful utils in the library to make this process more simple. Though if you want to augment images right on GPU, then you need something more involved.
from augmentor.
you may like miniconda to setup tensorflow with cpu / very simple to get up and running.
https://gist.github.com/johndpope/187b0dd996d16152ace2f842d43e3990
from augmentor.
Hello @mdbloice
Do you have some hints to get started?
from augmentor.
Tensorflow has the standard data processing API. I'm interested to interface Augmentor with the API.
As I can see, Augmentor is implemented entirely in Python. It should be possible to use tf.py_func to wrap Augmentor's functionality and provide data mappers that can be used with tf.data.Dataset
.
@mdbloice, I'm not very familiar with Augmentor, so what would be a good point to start? Also, can Augmentor process images on a GPU?
from augmentor.
I came across this repo the other week - https://github.com/tueimage/SE2CNN
it will build a roto-translation covariant convolutional network with tensorflow. (so you don't need to add extra images to training augmentation - the neural net will allow invariants in rotation / translation) https://arxiv.org/pdf/1804.03393
from augmentor.
fyi - Jonas Adler @adler-j has created a tensorflow example for deforming images with his own function. There's a tensorflow sample. Should be able to cherry pick / glue tensorflow code https://github.com/adler-j/tfdeform
from augmentor.
Hi @alshedivat, sorry for the delay in replying, work duties have kept me from doing any work on Augmentor for the past few weeks. Actually, what I am working on next is proper support for TensorFlow. Right now, using Augmentor with Keras should work, and PyTorch should also work. Next step is to get Augmentor working with TF properly without workarounds. Expect it in the next release (although I cannot say for sure when that might be, unfortunately).
from augmentor.
@mdbloice, cool, thanks for your reply! Do you have a roadmap for TF support? I'm pretty familiar with TF and it's Dataset API, so happy to contribute if that accelerates development.
Also, it looks like Augmentor doesn't use opencv, does it? Another image augmentation library shows that using highly optimized opencv gives best throughput.
from augmentor.
HI @alshedivat, no I do not really have a roadmap right now for TF support, I am only able to work on Augmentor when time allows. And it's not really predictable when that might be, so I cannot say for sure when I might be able to work on new features or bugs unfortunately!
As for OpenCV, no I do not use it because it is a rather large dependency that I wanted to avoid. The library you linked to looks good though! I think with multi-threading the throughput in Augmentor is pretty good.
As for contributing, that would be great - I presume TF expects a generator of some kind, and if you check out the code for the keras_generator()
function, you'll see how it works:
Augmentor/Augmentor/Pipeline.py
Lines 456 to 543 in 5a8f6d6
If you can write a function like tf_generator
or something similar that would output images in the format that is expected by TensorFlow, then I think that would be all there is to it! Let me know what you think.
from augmentor.
Related Issues (20)
- How to read and output uint16 images with Augmentor?
- moudle 'Augmentor' has no attribute 'Pipeline'
- int() argument must be a string, a bytes-like object or a number, not 'Image' HOT 4
- why random_erasing sometimes cause error, but sometimes not. HOT 1
- OSError: cannot write mode RGBA as JPEG HOT 2
- What augments should you use?
- label interpolate issue
- p.ground_truth not work for p.add_operation HOT 3
- Not cropping skewed image to original image size HOT 1
- Random Ereasing areas too big HOT 5
- Question - Does it updated the labels too? HOT 3
- Use for Semantic Segmentation HOT 4
- Output dataset format Labelme JSON
- ValueError: image has wrong mode HOT 1
- ZeroDivisionError: float division by zero while performing augmentor.sample(num_samples)
- DataPipeline使用sample的时候会报错
- Incompatible with numpy >= 1.20 due to use of type aliases. HOT 1
- Rotation degrees are opposite. HOT 3
- Project dependencies may have API risk issues
- fail to build augmentor 0.2.11 due to a minor typo 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 augmentor.