docs
stringclasses 4
values | category
stringlengths 3
31
| thread
stringlengths 7
255
| href
stringlengths 42
278
| question
stringlengths 0
30.3k
| context
stringlengths 0
24.9k
| marked
int64 0
1
|
---|---|---|---|---|---|---|
tensorflow | General Discussion | Neural Network Benchmarking | https://discuss.tensorflow.org/t/neural-network-benchmarking/1490 | How can I calculate number of MACs and flops for a particular NN architecture ? | We already have a thread at:
Calculate Flops in Tensorflow and Pytorch are not equal? General Discussion
Given the same model, I found that the calculated flops in pytorch and tensorflow are different. I used the keras_flops (keras-flops · PyPI) in tensorflow, and ptflops (ptflops · PyPI) in pytorch to calculate flops. It seems that flops in pytorch are closed to my own calculation by hands. Is that tensorflow has some tricks to speed up the computation so that few flops are measured? My model in tensorflow
d=56
s=12
inp = Input((750 ,750, 1))
x = Conv2D(d, (5,5), padding='same')(inp)
x = PReLU()…
/cc @markdaoust @thea | 0 |
tensorflow | General Discussion | How to include python files in tensorflow package build? | https://discuss.tensorflow.org/t/how-to-include-python-files-in-tensorflow-package-build/1467 | I want to use the following file :
from tensorflow.python.grappler import model_analyzer
But tensorflow by default does not have the model_analyzer.py in pip packages. I can’t find the file under .../envs/tfenv/lib/python3.8/site-packages/tensorflow/python/grappler/.
However, the model_analyzer.py is indeed under the tensorflow’s source directory at /tensorflow/tensorflow/blob/master/tensorflow/python/grappler/model_analyzer.py
Why tensorflow ignores these files under grappler directory? How should I build tensorflow for using these files? | Stonepia:
model_analyzer
I’m assuming that you need to analyze the model, as seen on file name.
I don’t know is it just the same things as TFMA but since the beginning I’ve been using TFMA for model analyzer. If you want to give it a try, you can install it with;
pip install tensorflow-model-analysis
Hope it helps. | 0 |
tensorflow | General Discussion | Is Grappler’s autoparallel optimizer un maintained? | https://discuss.tensorflow.org/t/is-grapplers-autoparallel-optimizer-un-maintained/1476 | Is this optimizer currently unmaintained?
There is little docs about this. Also, it only applies to a few gradient ops from the code in tensorflow/core/grappler/optimizers. The autoparallel pass is quite straightforward and could only apply to few scenario, I think?
Could someone offer a little more information about this optimizer? | I think that the developmemt of these optimizations is going to migrate over MLiR
TensorFlow
tf.config.experimental.enable_mlir_graph_optimization 8
Enables experimental MLIR-Based TensorFlow Compiler Optimizations. | 0 |
tensorflow | General Discussion | Output of model.fit() | https://discuss.tensorflow.org/t/output-of-model-fit/1334 | What’s the meaning of loss & acc ? I mean they are loss and accuracy of training data but why the sum is not equal to 1? | Accuracy is a method for measuring performance based on the actual value and the predicted value.
Loss is a performance measure that is based on how much the predicted value varies from the actual value.
As they are different performance measures, their sum is not 1 (in most cases). | 0 |
tensorflow | General Discussion | Converting categorical datasets into continuous? | https://discuss.tensorflow.org/t/converting-categorical-datasets-into-continuous/1423 | Hi. I’ve been working on my first TF project for a few weeks now in my spare time. I’ve learned a ton but I’m still running into a few gaps in my understanding before I think I can get everything working.
I’m trying to use a CNN to predict a continuous value using images as input. I’m using the functions from keras.preprocessing.image to load the datasets but they expect the labels to be categorical. Is it possible to transform the labels into continuous values before training?
Like if I have categories [“1”, “2”, “3”] can I transform those labels to values [0.0, 0.333, 1.0] and run some kind of regression?
I’m having trouble finding resources for something like this so any help is super appreciated! | For further clarification, if it’s helpful.
My goal is to build a CNN-regression model. I’d like to predict a continuous value with an image as input. I’m not clear, reading the documentation, how to use the image-dataset functions provided in kera.preprocessing.image to load a dataset of images with numeric, continuous labeling.
Thanks! | 0 |
tensorflow | General Discussion | Autograd fails for reduce_sum on ragged tensor | https://discuss.tensorflow.org/t/autograd-fails-for-reduce-sum-on-ragged-tensor/1379 | While using tf.reduce_sum with ragged tensors, I stumbled upon an issue where autograd produces an exception in graph mode. The following code fails:
@tf.function()
def f(x):
return tf.reduce_sum(x, axis=-1)
def test_autograd():
values = tf.random.uniform((8,), seed=213)
sizes = tf.constant([4, 2, 2])
x = tf.RaggedTensor.from_row_lengths(values, sizes)
with tf.GradientTape() as tape:
tape.watch(x.flat_values)
y = f(x)
grad = tape.gradient(y, x.flat_values)
If I run test_autograd, I get an error:
self = <tf.Operation 'RaggedReduceSum/UnsortedSegmentSum' type=UnsortedSegmentSum>
name = '_XlaCompile'
def get_attr(self, name):
"""Returns the value of the attr of this op with the given `name`.
Args:
name: The name of the attr to fetch.
Returns:
The value of the attr, as a Python object.
Raises:
ValueError: If this op does not have an attr with the given `name`.
"""
fields = ("s", "i", "f", "b", "type", "shape", "tensor", "func")
try:
with c_api_util.tf_buffer() as buf:
> pywrap_tf_session.TF_OperationGetAttrValueProto(self._c_op, name, buf)
E tensorflow.python.framework.errors_impl.InvalidArgumentError: Operation 'RaggedReduceSum/UnsortedSegmentSum' has no attr named '_XlaCompile'.
../../venv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:2328: InvalidArgumentError
During handling of the above exception, another exception occurred:
scope = 'gradients'
op = <tf.Operation 'RaggedReduceSum/UnsortedSegmentSum' type=UnsortedSegmentSum>
func = None
grad_fn = <function _GradientsHelper.<locals>.<lambda> at 0x7f206004f4d0>
def _MaybeCompile(scope, op, func, grad_fn):
"""Compile the calculation in grad_fn if op was marked as compiled."""
scope = scope.rstrip("/").replace("/", "_")
if func is not None:
xla_compile = func.definition.attr["_XlaCompile"].b
xla_separate_compiled_gradients = func.definition.attr[
"_XlaSeparateCompiledGradients"].b
xla_scope = func.definition.attr["_XlaScope"].s.decode()
else:
try:
> xla_compile = op.get_attr("_XlaCompile")
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py:331:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tf.Operation 'RaggedReduceSum/UnsortedSegmentSum' type=UnsortedSegmentSum>
name = '_XlaCompile'
def get_attr(self, name):
"""Returns the value of the attr of this op with the given `name`.
Args:
name: The name of the attr to fetch.
Returns:
The value of the attr, as a Python object.
Raises:
ValueError: If this op does not have an attr with the given `name`.
"""
fields = ("s", "i", "f", "b", "type", "shape", "tensor", "func")
try:
with c_api_util.tf_buffer() as buf:
pywrap_tf_session.TF_OperationGetAttrValueProto(self._c_op, name, buf)
data = pywrap_tf_session.TF_GetBuffer(buf)
except errors.InvalidArgumentError as e:
# Convert to ValueError for backwards compatibility.
> raise ValueError(str(e))
E ValueError: Operation 'RaggedReduceSum/UnsortedSegmentSum' has no attr named '_XlaCompile'.
../../venv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:2332: ValueError
During handling of the above exception, another exception occurred:
def test_autograd():
values = tf.random.uniform((8,), seed=213)
sizes = tf.constant([4, 2, 2])
x = tf.RaggedTensor.from_row_lengths(values, sizes)
with tf.GradientTape() as tape:
tape.watch(x.flat_values)
> y = f(x)
graphs/tf2_sandwich_model_test.py:170:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py:580: in __call__
result = self._call(*args, **kwds)
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/def_function.py:650: in _call
return self._concrete_stateful_fn._filtered_call(canon_args, canon_kwds) # pylint: disable=protected-access
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/function.py:1665: in _filtered_call
self.captured_inputs)
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/function.py:1751: in _call_flat
forward_function, args_with_tangents = forward_backward.forward()
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/function.py:1477: in forward
self._inference_args, self._input_tangents)
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/function.py:1233: in forward
self._forward_and_backward_functions(inference_args, input_tangents))
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/function.py:1385: in _forward_and_backward_functions
outputs, inference_args, input_tangents)
../../venv/lib/python3.7/site-packages/tensorflow/python/eager/function.py:943: in _build_functions_for_outputs
src_graph=self._func_graph)
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py:669: in _GradientsHelper
lambda: grad_fn(op, *out_grads))
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py:336: in _MaybeCompile
return grad_fn() # Exit early
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/gradients_util.py:669: in <lambda>
lambda: grad_fn(op, *out_grads))
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/math_grad.py:470: in _UnsortedSegmentSumGrad
return _GatherDropNegatives(grad, op.inputs[1])[0], None, None
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/math_grad.py:438: in _GatherDropNegatives
dtype=is_positive_shape.dtype)],
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:2967: in ones
output = _constant_if_small(one, shape, dtype, name)
../../venv/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py:2662: in _constant_if_small
if np.prod(shape) < 1000:
<__array_function__ internals>:6: in prod
???
../../venv/lib/python3.7/site-packages/numpy/core/fromnumeric.py:3031: in prod
keepdims=keepdims, initial=initial, where=where)
../../venv/lib/python3.7/site-packages/numpy/core/fromnumeric.py:87: in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tf.Tensor 'gradients/RaggedReduceSum/UnsortedSegmentSum_grad/sub:0' shape=() dtype=int32>
def __array__(self):
raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy"
> " array.".format(self.name))
E NotImplementedError: Cannot convert a symbolic Tensor (gradients/RaggedReduceSum/UnsortedSegmentSum_grad/sub:0) to a numpy array.
../../venv/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:749: NotImplementedError
If I call tf.reduce_sum directly in the test (without going through f), it does work though. How can I avoid this problem? | What is your TF version? | 0 |
tensorflow | General Discussion | Introducing TensorFlow to high school students | https://discuss.tensorflow.org/t/introducing-tensorflow-to-high-school-students/798 | Hi! Joined today during the TensorFlow Community Team meet.
I have found learning new things is easier when doing some lessons for a local high school I volunteer at.
I see the following resources and have also gone through the freecodecamp resource:
TensorFlow
Machine learning education | TensorFlow 41
Start your TensorFlow training by building a foundation in four learning areas: coding, math, ML theory, and how to build an ML project from start to finish.
Any tips or suggestions on your favorite intro course (accessible to learners, 14-18) would be much appreciated. Either from anyone who has undertaken this themselves or has some ideas on how they might do it.
Thanks, and excited to be here. | If your students know and use Python, I created an “ML Foundations” course on YouTube. You can find it on the YT channel, and it might work well for them. | 0 |
tensorflow | General Discussion | Looking for a mentor in ML and MLOps using TensorFlow | https://discuss.tensorflow.org/t/looking-for-a-mentor-in-ml-and-mlops-using-tensorflow/1225 | Hello All
I am looking for a mentor in my journey of becoming a machine learning engineer. I would like to contact GDEs for this. What is the best way to contact them ?
Thanks
Balu | Adding @Soonson_Kwon who might have a better insight on who to get in touch with from the GDE Program!
Also @Sayak_Paul fyi! | 0 |
tensorflow | General Discussion | Keras TF2.0 SavedModel Input/Output Nodes | https://discuss.tensorflow.org/t/keras-tf2-0-savedmodel-input-output-nodes/1364 | Hello!
I am trying to perform model conversions on a TensorFlow2.0 SavedModel and I need to know what the input nodes, input dimensions, and output nodes are. I am trying to use the ‘graph_transforms:summarize_graph’ tool but I keep getting the following error: Can’t parse saved_model.pb as binary proto (both text and binary parsing failed for file saved_model.pb)
I also tried to visualize the graph using Tensorboard, but it provides complicated graphs that are not so obvious.
Any recommendations?
Thanks,
Ahmad | Have you tried using GitHub - lutzroeder/netron: Visualizer for neural network, deep learning, and machine learning models 16 to visualize your model.
You may try using browser version that allows you to quickly upload your model and it displays op level graph. | 0 |
tensorflow | General Discussion | Tensorflow for PHP | https://discuss.tensorflow.org/t/tensorflow-for-php/1373 | Hello, TensorFlow is, it seems to me under MIT license, I saw that there was tensorFlow JS, like a lot of people I have an allergy to JavaScript, is there an official PHP version planned, there is many forks, but hey … and I prefer to limit, as much as possible JSON | Not as a wrapper.
Instead if you need to consume model inference with PHP you could use the serving REST API
TensorFlow
RESTful API | TFX | TensorFlow 10 | 0 |
tensorflow | General Discussion | Faster RCNN Transfer Learning | https://discuss.tensorflow.org/t/faster-rcnn-transfer-learning/978 | Excuse me does anybody know how to transfer learning a Faster RCNN to my own dataset? Or is there any reference for that? because I still don’t understand is it included as my base network in my model or what. Thank you very much | How about the following, though I’ve not tested this yet:
In TensorFlow Hub (a repository of pre-trained TensorFlow models), click on/search for “object detection” models: (link to Image Object Detection results: TensorFlow Hub 25)
In the results, there is faster_rcnn/openimages_v4/inception_resnet_v2 (link: TensorFlow Hub 17)
Object detection model trained on Open Images V4 with ImageNet pre-trained Inception Resnet V2 as image feature extractor.
FasterRCNN+InceptionResNetV2 network trained on Open Images V4.
Then, check out the Transfer learning with TensorFlow Hub | TensorFlow Core 28 tutorial.
Looping in @lgusm (DevRel) and the docs team - notebook co-authors @billy @markdaoust | 0 |
tensorflow | General Discussion | Some impressive tutorial to learning TFX | https://discuss.tensorflow.org/t/some-impressive-tutorial-to-learning-tfx/1231 | in this topic, you will find some impressive tutorial that will help you to learn TFX
1200×675 31.3 KB
Resources
TensorFlow Page 10
TensorFlow Extended (TFX) 8
ML Pipelines on Google Cloud 10
Manage a production ML pipeline with TFX 15
How to build an ML pipeline with TFX 9
MLOps Specialization 5
I hope it will help you and feel free to add more tutorial | The MLOps Specialization on Coursera is also great:
Coursera
Machine Learning Engineering for Production (MLOps) 9
Offered by DeepLearning.AI. Become a Machine Learning expert. Productionize your machine learning knowledge and expand your production ... Enroll for free. | 0 |
tensorflow | General Discussion | TensorFlow Lite for Microcontrollers with Arduino uno | https://discuss.tensorflow.org/t/tensorflow-lite-for-microcontrollers-with-arduino-uno/1171 | Hi there
I plan to build a machine learning project with Tesnsorflow lite and Arduino for The TensorFlow Microcontroller Challenge 25
and I have a question, it is possible to implement a tflite model on Arduino UNO or not?
and if you give me an example I will be thankful | Hey Kareem!
Check this session during #GoogleIO .
Building with TensorFlow Lite for microcontrollers 43
This may help you.
Thanks. | 0 |
tensorflow | General Discussion | F.interpolation alternative in tensorflow | https://discuss.tensorflow.org/t/f-interpolation-alternative-in-tensorflow/1241 | Hi,
What is the alternative op of PyTorch F.interpolation in TensorFlow
Thanks | You could use tf.image.resize:
TensorFlow
tf.image.resize | TensorFlow Core v2.5.0 3
Resize images to size using the specified method. | 0 |
tensorflow | General Discussion | Multilingual sentence encoder | https://discuss.tensorflow.org/t/multilingual-sentence-encoder/667 | I was looking for a model to process French sentences, but I can’t find any for TF.js. So, using tensorflowjs_converter, I tried to convert the universal-sentence-encoder-multilingual model (TensorFlow Hub 2), but it’s not working.
I get an error “Op type not registered ‘SentencepieceOp’ in binary running”
Is there an existing multilingual model available for TF.js or a way to make it work?
Thanks! | Have you checked TF2.0 hub Universal Sentence Encoder Multilingual Sentenepieceop not registered problem · Issue #463 · tensorflow/hub · GitHub 7? | 0 |
tensorflow | General Discussion | Export Control Classification Number (ECCN) of TensorFlow | https://discuss.tensorflow.org/t/export-control-classification-number-eccn-of-tensorflow/1279 | Can someone please if TF has an ECCN, and if yes, what it is? | I don’t think we have specific info. See
github.com/tensorflow/tensorflow
Export Control Classification Number (ECCN) for Tensorflow 11
opened
Jan 22, 2019
closed
Jan 23, 2019
zygfrydw
**System information**
- TensorFlow version: 1.8.0
- Doc Link:
I would like… to use Tensorflow in commercial software which will be sold in the U.S. For this reason, the legal department asks me about Export Control Classification Number (ECCN) for Tensorflow library. From my understanding, the open sources software is not subject to [Encryption and Export Administration Regulations (EAR)](https://www.bis.doc.gov/index.php/policy-guidance/encryption/1-encryption-items-not-subject-to-the-ear).
Can anyone confirm that Tensorflow is not a subject to EAR or point a ECCN class for Tensorflow?
Does Tensorflow use any encryption functionality, which should be mention when applying for ECCN for software which uses Tensorflow? | 0 |
tensorflow | General Discussion | Enable grappler’s autoparallel pass | https://discuss.tensorflow.org/t/enable-grapplers-autoparallel-pass/1084 | Grappler offers an autoparallel optimizer as stated in (TensorFlow graph optimization with Grappler | TensorFlow Core 6).
But there is no explicit tools for setting the flag, the tf.config.optimizer.set_experimental_options() does not offer this option (auto_parallel) either.
How could I enable this? Thanks in advance | It is available but not documented. I think you could open a Docoumentation type issue on Github 1
github.com
tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/rewriter_config.proto#L14-L17 3
message AutoParallelOptions {
bool enable = 1;
int32 num_replicas = 2;
}
github.com
tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/rewriter_config.proto#L177-L179 3
// Configures AutoParallel optimization passes either through the
// meta-optimizer or when manually specified through the optimizers field.
AutoParallelOptions auto_parallel = 5; | 0 |
tensorflow | General Discussion | LSTM for sequences of geometric shapes | https://discuss.tensorflow.org/t/lstm-for-sequences-of-geometric-shapes/1172 | Hi guys, could you please shed light on the following?
Requirement:
Create a sequence predictor based on geometric shapes
Shapes can be circles, rectangles and triangles
Such shapes can vary in size and angles if they have
The sequencer should try to predict the most likely next shape and its size.
What has been tried:
Basics:
The data has been normalized
Training data, validation data and test data are separate and different sets
Implementation:
Passed the shape’s numeric data as part of the sequence e.g. the points that represent the triangle, it seems the LSTM is trying to do some math with it and it never picks a pattern, I guess, given the different shapes
Make the shape’s point strings and use a categorical LSTM: the strings are so varied that no pattern is picked
Round the numbers of the dimensions and make them string: too much precision gets lost and I get a crazy big dictionary , no pattern is picked
In all cases the Test data evaluation is no more than 40% accurate
Any ideas to tackle this type of requirement?
Thanks! | Hello George,
I’m not sure how much this will help, but here are a few things I might think about too. And these might be things you’re already thinking about too!
First is to be careful with how the data is normalized, think about the domain and range of your inputs and outputs. If all of your circles have a max radius of 10, it might be hard for your model to predict a number larger than that.
Second is maybe you can describe the shapes differently than points. I’m not sure exactly what your data looks like, but coordinates I think might not be important. Without putting the shapes on a coordinate system, you could define any rectangle for example with just a height and width, any circle could be defined with just a radius, and I think a triangle could be defined with two side lengths and the angle between them. You could use these simpler representations as inputs and outputs, and maybe they would be easier for the model to pick up.
Third is maybe try breaking up the problem a bit, like first predicting what type of shape comes next, then predicting the dimensions and size of that shape.
I hope this helps a bit! | 0 |
tensorflow | General Discussion | “To discuss” Do you think TFX is enough to complete a full MLops project? | https://discuss.tensorflow.org/t/to-discuss-do-you-think-tfx-is-enough-to-complete-a-full-mlops-project/1230 | Hi, I am very interested in the TFX project and started learning and contributing to it on GitHub
And I hope one day I will become a member of TFX Team
In this topic, I want to discuss the readiness of TFX to complete the MLops pipeline
Does just learning TFX get you ready to complete projects or will you need more tools to complete your project?
Excited to hear from the TensorFlow team’ answers | In my opinion, tfx provides enough features to complete mlops project but you will need additional engineering to do it.
tfx helps a large part of mlops. | 0 |
tensorflow | General Discussion | Record linking in two tables | https://discuss.tensorflow.org/t/record-linking-in-two-tables/1113 | I’m interested in learning tensor flow. I have a real world problem where I have two tables of data, the data is made up of columns of types strings, numbers and dates.
Each row in table 1 has an equivalent entry in table 2. The data in table 2 will be similar but not exactly equal to it’s equivalent in table 1. Is it possible to use tensor flow to identify which records are related to each other? | That’s a great question!
I think it depends how you define that “relation”. You may be familiar with some of these methods, but please check them out if you’re not! You could do something like an encoder decoder network, and then compare the encodings with a distance similarity (like cosine distance). But you could also try that with a method like PCA.
Encoding and PCA, in a simplified sense, take your records and convert them to a few numbers, so you can then just compare the numbers with some distance formula. There are some great tutorials on using Keras for encoders, so please check them out!
Scikit-learn has some good documentation on PCA (principal component analysis), and the tensorflow and keras site have some good code examples, including some on encoders (usually with images, but it’s the same concept).
I hope this helps! | 0 |
tensorflow | General Discussion | Any suggestions to start with TensorFlow? | https://discuss.tensorflow.org/t/any-suggestions-to-start-with-tensorflow/913 | I am a high school student and ML is very fascinating to me. That’s why I spent most of my last year studying ML and deep learning algorithms (using python). A few months ago, I came to know about TensorFlow so I tried its keras.layers to make some custom models. It’s a great tool but it’s like a sea of features which makes it very complicated too (at least for me). So I am looking for some suggestion about where can I start learning it or some learning path or some guide. ThankYou. | Hello! Check out these posts in a related thread:
Introducing TensorFlow to high school students General Discussion
If your students know and use Python, I created an “ML Foundations” course on YouTube. You can find it on the YT channel, and it might work well for them.
Introducing TensorFlow to high school students General Discussion
Hi @dan To add to what @Laurence_Moroney said, you can also check out the MOOCs mentioned on this page: Basics of machine learning | TensorFlow featuring @Laurence_Moroney and @Magnus
Also, if you haven’t already, check out the notebooks you can run in Colab: Machine Learning Basics with Keras (under TensorFlow.org Tutorials: Basic classification: Classify images of clothing | TensorFlow Core) and TensorFlow Basics (under TensorFlow.org Guides: Eager execution | TensorFlow Cor…
Introducing TensorFlow to high school students General Discussion
Hi @dan, here are two book recommendations you can use to learn more (both are excellent).
Manning | Deep Learning with Python, Second Edition
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition [Book]
Introducing TensorFlow to high school students General Discussion
Hi @dan ,
I am also a high school student working with TensorFlow. I personally started off learning Machine Learning from Andrew Ng’s courses and strongly think they could build the basics for students. To learn specifically about TensorFlow I used and would recommend:
TF in Practice (now called TensorFlow Developer)
TF: Data and Deployment
by @Laurence_Moroney . Apart from this, I think the official TensorFlow Guide is a quite systematic approach to learn. Being in High school myself, anot… | 0 |
tensorflow | General Discussion | ShowAndTell for TFLite | https://discuss.tensorflow.org/t/showandtell-for-tflite/178 | First, thanks for the forum. It was much needed
Second, there could be another tag on TFLite.
Third, we have a TFLite working group that consists of ML GDEs, Googlers like Khanh and Hoi, and other community contributors that are passionate about the TinyML revolution. The working group has emerged to be one of the most active ones and together we have been able to:
Develop mobile applications that demonstrate best and advanced practices of TFLite.
Publish state-of-the-art TFLite models (from different data modalities) on TensorFlow Hub.
Write in-depth technical tutorials.
To better recognize these efforts, I think it might be a great option to also host something similar to what Jason does with TFJs ShowAndTell. Looking forward to hearing what others have to say. | Not able to include links in my post. But in case if someone is interested to see where we track all of the aforementioned efforts, go over to ml-gde/e2e-tflite-tutorials 11 on GitHub. | 0 |
tensorflow | General Discussion | Tensorflow OpenSlide dataset | https://discuss.tensorflow.org/t/tensorflow-openslide-dataset/1136 | how to create a dataset sampling patches from WSI randomly. | Do you have already tested GitHub - SarderLab/tf-WSI-dataset-utils: An optimized pipeline for working with Whole Slide Image (WSI) data in Tensorflow 18 ? | 0 |
tensorflow | General Discussion | Building a recommendation engine in TF | https://discuss.tensorflow.org/t/building-a-recommendation-engine-in-tf/1131 | Hey, Guys I want to build a recommendation system using TF or TF.js for my web application ,Can I get suggestions on blogs or videos I could refer. | Have you already explored TensorFlow Recommenders (TFRS)?
blog.tensorflow.org
Introducing TensorFlow Recommenders 15
Introducing TensorFlow Recommenders, a library for building flexible and powerful recommender models. | 0 |
tensorflow | General Discussion | Tensorflow.keras.LSTM vs. tf.contrib.rnn.LSTMBlockFusedCell | https://discuss.tensorflow.org/t/tensorflow-keras-lstm-vs-tf-contrib-rnn-lstmblockfusedcell/1107 | I have a TF 1.14 model which uses “tf.contrib.rnn.LSTMBlockFusedCell”, which I am trying to replicate in TF2.4. It is a variant of “DeepSpeech, v. 0.5.1”.
Both models have one LSTM and five Dense layers.
The layer weights are loaded from a DeepSpeech v. 0.5.1 Checkpoint into the TF2.4 model,
taking care to split kernel from recurrent_kernel, and re-ordering the blocks
(i,c,f,o) → (i,f,c,o) as suggested by a kind person here.
The models take same input, all other layers (the five Dense layers) have same inputs and outputs, only the LSTM layers have different outputs in teh two models.
The final outputs are in the same order of magnitude, but the TF2.4 result is not close to correct, that is: does not translate audio to text, which the TF1.14 model does almost satisfactorily.
Does anyone here know whether Tensorflow.keras.LSTM and tf.contrib.rnn.LSTMBlockFusedCell are in fact designed to work identically? Am I wasting my time trying to get the same results? | I don’t know if you could be interested to explore the upstream diff on how they are refactoring the model (to remove also the old contrib):
github.com/mozilla/DeepSpeech
Low touch upgrade to TensorFlow 2.3 15
mozilla:master ← mozilla:low-touch-r2.3
opened
Jan 2, 2021
reuben
+476
-1252
Keeps changes to a minimum by leveraging the fact that under a `tfv1.Session` ob…ject, TensorFlow v1 style meta-graph construction works normally, including placeholders. This lets us keep changes to a minimum. The main change comes in the model definition code: the previous LSTMBlockCell/static_rnn/CudnnRNN parametrized RNN implementation gets replaced by `tf.keras.layers.LSTM` which is supposed to use the most appropriate implementation given the layer configuration and host machine setup. This is a graph breaking change and so GRAPH_VERSION is bumped. | 0 |
tensorflow | General Discussion | Audio classification: Getting train_function error when trying to fit model | https://discuss.tensorflow.org/t/audio-classification-getting-train-function-error-when-trying-to-fit-model/899 | The title describes the gist of the issue, details and code are here: python - Getting "Function call stack: train_function -> train_function" error when training tensorflow2 LSTM RNN - Stack Overflow 14
Does anyone know why this error is happening? I cannot for the life of me figure it out. | Guy_Berreby:
python - Getting “Function call stack: train_function → train_function” error when training tensorflow2 LSTM RNN - Stack Overflow
Hi @Guy_Berreby, what type of music data are you working on? For instance, if it’s in a MIDI format, then I can see why you’re using the LSTM architecture. I also noticed you’re using tfio.audio.AudioIOTensor ( tfio.audio.AudioIOTensor | TensorFlow I/O 2) - maybe your two datasets are waveform-based. Can you please share some info and how you’re loading the data (code)?
I’ve summarized your code and the task below with some formatting, based on the information in the StackOverflow post you shared. @Guy_Berreby do let me know if the spaces and other info are correct, I had to make some minor adjustments:
Your ML task
Music genre classification, two different genres - bm and dm
Code
RNN (LSTM) model:
model = keras.Sequential()
# Add an Embedding layer expecting input vocab of size 1000, and
# output embedding dimension of size 64.
model.add(layers.Embedding(input_dim=maxLen, output_dim=2,mask_zero=True))
#model.add(layers.Masking())
# Add an LSTM layer with 128 internal units.
# model.add(layers.Input(shape=[1,None]) )
model.add(layers.LSTM(8,return_sequences=True))
model.add(layers.Dropout(0.2) )
model.add(layers.LSTM(8))
model.add(layers.Dropout(0.2) )
# Add a Dense layer with 10 units.
model.add(layers.Dense(16,activation="relu"))
model.add(layers.Dropout(0.2))
model.add(layers.Dense(2,activation="softmax"))
model.compile(loss='categorical_crossentropy', optimizer='adam')
Generator:
def modelTrainGen(maxLen):
# One type of music - training set
bmTrainDirectory = '/content/drive/.../...train/'
# Another type of music - training set
dmTrainDirectory = '/content/drive/.../...train/'
dmTrainFileNames = os.listdir(dmTrainDirectory)
bmTrainFileNames = os.listdir(bmTrainDirectory)
maxAudioLen = maxLen
bmTensor = tf.convert_to_tensor([[1],[0]])
dmTensor = tf.convert_to_tensor([[0],[1]])
allFileNames = []
for fileName in zip(bmTrainFileNames,dmTrainFileNames):
bmFileName = fileName[0]
dmFileName = fileName[1]
allFileNames.append((bmFileName,1))
allFileNames.append((dmFileName,0))
random.shuffle(allFileNames)
for fileNameVal in allFileNames:
fileName = fileNameVal[0]
val = fileNameVal[1]
if val == 1:
bmFileName = fileName
audio = tfio.audio.AudioIOTensor(bmTrainDirectory + bmFileName)
audio_slice = tf.reduce_max(tf.transpose(audio[0:]),0)
del audio
print(audio_slice.shape)
padded_x = tf.keras.preprocessing.sequence.pad_sequences( [audio_slice], padding="post",
dtype=float,maxlen=maxAudioLen )
del audio_slice
converted = tf.convert_to_tensor(padded_x[0])
del padded_x
print("A")
print(converted.shape)
yield ( converted,bmTensor)
print("B")
del converted
else:
dmFileName = fileName
audio = tfio.audio.AudioIOTensor(dmTrainDirectory + dmFileName)
audio_slice = tf.reduce_max(tf.transpose(audio[0:]),0)
del audio
print(audio_slice.shape)
padded_x = tf.keras.preprocessing.sequence.pad_sequences( [audio_slice], padding="post", dtype=float,maxlen=maxAudioLen)
del audio_slice
converted = tf.convert_to_tensor(padded_x[0])
del padded_x
print("C")
print(converted.shape)
yield ( converted,dmTensor)
print("D")
del converted
(The following TensorFlow docs are for waveform-based data - could be useful in future:
Audio Data Preparation and Augmentation | TensorFlow I/O 2
Simple audio recognition: Recognizing keywords | TensorFlow Core 2
Transfer Learning with YAMNet for environmental sound classification 2 ) | 0 |
tensorflow | General Discussion | What MOOC would you like to see next? | https://discuss.tensorflow.org/t/what-mooc-would-you-like-to-see-next/137 | We’ve done 12 courses on TensorFlow at Coursera for TensorFlow:In Practice; TensorFlow: Data and Deployment; and TensorFlow: Advanced Techniques.
We have an upcoming specialization on MLE covering TFX etc
We also influenced their NLP and Medical AI specializations.
What would you want to see next? | Reponsible AI Practices with TensorFlow. | 0 |
tensorflow | General Discussion | TypeError: dataset length is unknown tensorflow | https://discuss.tensorflow.org/t/typeerror-dataset-length-is-unknown-tensorflow/948 | I was playing with this function from tf.data called tf.data.Dataset.from_generator() where it takes a ImageDataGenerator object and turns it into a Dataset Object. Everything was fine but when I fit my model I can’t use steps_per_epoch and validation_steps including them throws an error,
Screenshot 2021-05-20 at 3.39.15 AM1153×541 68.5 KB
TypeError: dataset length is unknown.
Then I commented them out and continued to fit the model but its training for infinitely seems there is no stopping. I have attached my images. (edited)
Screenshot 2021-05-20 at 3.15.58 AM709×637 42.8 KB
When I use .from_generator it automatically converts from ImageDatagenerator to a Dataset object but not sure why it’s still considering it as a generator and throwing error.
Any help on this? | ashikshafi0:
tf.data.Dataset.from_generator()
Looping in @Andrew_Audibert
I also checked for similar Issues here (keyword: tf.data.Dataset.from_generator - Issues · tensorflow/tensorflow · GitHub 13) - in case someone has encountered a similar issue. | 0 |
tensorflow | General Discussion | Is Tensorflow Swift not proceeding anymore? | https://discuss.tensorflow.org/t/is-tensorflow-swift-not-proceeding-anymore/986 | I can not find tf swift here and github.
Is it archived?? | Are you looking for this one? GitHub - tensorflow/swift: Swift for TensorFlow 4 | 0 |
tensorflow | General Discussion | Greets for Newbies | Asking Suggestion to Kickstart | https://discuss.tensorflow.org/t/greets-for-newbies-asking-suggestion-to-kickstart/889 | How you guys, going to greet for tensorflow newbie’s like me.
PS:- This post is open to share suggestion to help learn tensorflow learn efficiently with experienced professional. | Check out this thread which covers a lot of material for new TensorFlow users:
Introducing TensorFlow to high school students General Discussion
If your students know and use Python, I created an “ML Foundations” course on YouTube. You can find it on the YT channel, and it might work well for them.
Hope this helps! cc @Laurence_Moroney @jbgordon @lgusm @Jason | 0 |
tensorflow | General Discussion | Running TensorFlow.js in GraalVM | https://discuss.tensorflow.org/t/running-tensorflow-js-in-graalvm/947 | I would like to get some help to make tf.js run in this environment/setup:
GraalVM: https://www.graalvm.org/ 4
TypeScript: https://www.typescriptlang.org/ 2
Do you think it is possible? I’m still pretty new to TypeScript so a sample code/project would be very helpful. Here’s my current tsconfig if it helps:
{
“compilerOptions”: {
“module”: “amd”,
“target”: “es5”,
“moduleResolution”: “node”,
“allowJs”: true,
“sourceMap”: false,
“newLine”: “LF”,
“esModuleInterop”: true,
“baseUrl”: “.”,
“rootDir”: “./src/TypeScript/”,
“outDir”: “./src/FileCabinet/SuiteApps/com.netsuite.unittestreference/src”,
“lib”: [“es2015”, “dom”],
“skipLibCheck”: true,
“paths”: {
“N”: [“node_modules/@hitc/netsuite-types/N”],
“N/": ["node_modules/@hitc/netsuite-types/N/”],
“n”: ["./src/TypeScript/types/n"],
“n/": ["./src/TypeScript/types/n/”]
}
},
“exclude”: ["./test//", "./src/TypeScript/types/"],
“include”: ["./src/TypeScript//*"]
}
I tried using the CDN version and I got this error:
Error: Could not find a global object [at Rg (/SuiteApps/com.netsuite.unittestreference/src/app/HelloTypeScriptPage/main/tf.min.js:17:125032)]
I also tried the npm version, the tf.js doesn’t seem to be automatically built by TypeScript. I have some experience on webpack. Should I use a bundler? | Looping in @Jason | 0 |
tensorflow | General Discussion | Community Ecosystem of TensorFlow Lite | https://discuss.tensorflow.org/t/community-ecosystem-of-tensorflow-lite/935 | This is primarily for the folks working in TensorFlow Lite and on-device ML.
Today, I gave a short talk at this meetup:
gdg.community.dev
Machine Learning developers Meetup [EMEA/APAC] | Google Developer Groups 6
I’m attending the I/O Community Lounge Meetups meetup on May 20, 2021! Learn more and join me: https://gdg.community.dev/e/mnrmef/ @GDG
I talked about the collaborative efforts TensorFlow Lite community has been making from the last year:
docs.google.com
Community Ecosystem of TFLite 9
Community Ecosystem of TensorFlow Lite Sayak Paul PyImageSearch @RisingSayak
image1312×724 30.3 KB
image1264×687 114 KB
image1219×661 95.2 KB
@lgusm @Laurence_Moroney | I really loved the talk and it was pretty great seeing so much awesome work by the TFLite Community. Thanks for sharing the slides! | 0 |
tensorflow | General Discussion | Equivalent of “torch.cuda.LongTensor” in tensorflow | https://discuss.tensorflow.org/t/equivalent-of-torch-cuda-longtensor-in-tensorflow/918 | Hello,
I try to convert an existing code in pytorch to tensorflow. In the original code, they use “dtype=torch.cuda.LongTensor” to specify using GPU. Is there any alternative in tensorflow ? I have tried to use classical types of tensorflow such as “dtype =tf.dtypes.int64” but the code is very slow.
Thank you for your help. | Hello,
the device placement can be specified using tf.device in this way:
with tf.device("/gpu:0"):
x = tf.Variable(shape, dtpe=tf.int64) # shape is a variable defined somewhere, with the shape
In this case the x variable is placed in the first GPU, and the type is 64 bit integer | 0 |
tensorflow | General Discussion | RandAugment for Image Classification for Improved Robustness | https://discuss.tensorflow.org/t/randaugment-for-image-classification-for-improved-robustness/206 | Hi folks,
I always wanted to use RandAugment to improve the robustness of my vision models. But never found a straightforward example that showed how to use it in the context of TensorFlow and Keras.
Now, together with the community, we have one such example showing a clear advantage of RandAugment for improving the robustness of vision models:
keras.io
Keras documentation: RandAugment for Image Classification for Improved... 27
The example shows how to use the imgaug library together with tf.py_function inside tf.data pipelines. Of course, it has its own demerits. But hey, that’s life! | Nice but It could be useful to expose to the user what we have at models/augment.py at master · tensorflow/models · GitHub 10
models/augment.py at master · tensorflow/models · GitHub 9
Probably TF ops could have a better performance then tf.py_function with imageaug. | 0 |
tensorflow | General Discussion | Why there is no YOLO models at TensorFlow Hub or Model Garden | https://discuss.tensorflow.org/t/why-there-is-no-yolo-models-at-tensorflow-hub-or-model-garden/829 | I would like to retrain a YOLOv4 model, but I prefer a more mainstream environment than the Darknet. I looked at the catalog of models at TensorFlow Hub and Model Garden, but there is no YOLO models there. YOLO achieves the fastest frame rates for object detection in many benchmarks. What is the reason for a lack of official Google support? Is it just a sheer quantity of various models to support or superior models already available at TensorFlow Hub and Model Garden? | Hi Paul,
publishing models on TFHub or Model Garden depends on the model creator to decide to do so.
Researchers from Google published multiple Object Detection models 200 that can be fine tuned using Model Maker 76.
For Yolo specifically, I guess the problem is that the creator didn’t want to publish it on TFHub yet. Would be great if they did. | 0 |
tensorflow | General Discussion | What is the best approach to debug in TensorFlow when working with the C++ code base? | https://discuss.tensorflow.org/t/what-is-the-best-approach-to-debug-in-tensorflow-when-working-with-the-c-code-base/468 | In the past, I’ve had issues debugging in TensorFlow where the problem was somewhere in the C++ code base and I was using gdb, these included debug builds being too large (using -O0) and running out of space, recompile time etc. Does anyone have recommendations to handle debugging in TensorFlow? | I think that some of these problems are well known. For a recent experience you can follow this:
github.com/tensorflow/tensorflow
cannot build TensorFLow with --config=dbg 26
opened
May 6, 2021
bas-aarts
when building opensource TensorFlow with
bazel build --config=dbg --config=cuda --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" //tensorflow/tools/pip_package:build_pip_package
(for SM 7.0 only)
The build dies at link time with:
ERROR: /home/baarts/tensorflow-GH/tensorflow/python/BUILD:3373:24: Linking...
subtype: ubuntu/linux
subtype:bazel
type:build/install
In the end there is a draft proposal so If you have something technical to share about your experience please leave a comment in the ticket. | 0 |
tensorflow | General Discussion | Docs contributions and support channels footer | https://discuss.tensorflow.org/t/docs-contributions-and-support-channels-footer/185 | What do you think about adding a Docs contributions and support links footer in every Docs webpage like in Github Docs 2
image1137×234 21 KB | Interested to hear your thoughts @billy. | 0 |
tensorflow | General Discussion | Randomly sampling equal points ensuring equal number per class | https://discuss.tensorflow.org/t/randomly-sampling-equal-points-ensuring-equal-number-per-class/452 | Hi folks.
Currently, I have a requirement for a batch of data that should have an equal number of samples from each of the given classes.
I am implementing it using the naive way for CIFAR10:
def support_sampler():
idx_dict = dict()
for class_id in np.arange(0, 10):
subset_labels = sampled_labels[sampled_labels == class_id]
random_sampled = np.random.choice(len(subset_labels), 16)
idx_dict[class_id] = random_sampled
return np.concatenate(list(idx_dict.values()))
def get_support_ds():
random_balanced_idx = support_sampler()
temp_train, temp_labels = sampled_train[random_balanced_idx],\
sampled_labels[random_balanced_idx]
support_ds = tf.data.Dataset.from_tensor_slices((temp_train, temp_labels))
support_ds = (
support_ds
.shuffle(BATCH_SIZE * 1000)
.map(agumentation, num_parallel_calls=AUTO)
.batch(BATCH_SIZE)
)
return support_ds
Is there a better way? Particularly using pure TF ops with tf.data? | Here the approach I used was to make a dataset for each class, and then merge them.
TensorFlow
Classification on imbalanced data | TensorFlow Core 13
I used sample_from_datasets so it’s approximately equal. But you could also zip the datasets then and .map a function to stack all the zipped tensors. | 0 |
tensorflow | General Discussion | Virtual Environment vs Containers | https://discuss.tensorflow.org/t/virtual-environment-vs-containers/479 | I currently have a virtual environment inside which I have installed all the packages that I want (tensorflow, … ) and I use it to work locally. I constantly update the packages to the latest releases however, I am usually stuck on python 3.6
Is it the best approach to work locally? Or are containers a better approach where I can easily update my packages including python’s version.
If so, is there any guideline on how to create my environment inside containers?
Thanks!
Fadi | I found while containers have more of a learning curve they are much easier in the long run. TensorFlow even has containers with source so you can build TensorFlow versions you need without installing a bunch of tooling on your system. If you use a GPU Nvidia-docker is by far the easiest way to get up and running with TensorFlow on a GPU. Best of all you avoid the “it works on my machine” issues where you can ship your container to the cloud or provide them to other developers to pickup and join your project. | 0 |
tensorflow | General Discussion | Regression on Structured Data | https://discuss.tensorflow.org/t/regression-on-structured-data/480 | I’m currently working on a project where of course the question of neural networks comes up. We are working on a fairly simple regression problem that has some noise in the data. My current approach is testing a few different networks including Random Forest and XGBoost.
I did run some test with TensorFlow but I didn’t see much better results to justify the increased training time.
However I figured I should ask people a bit more seasoned than myself, why should I use TensorFlow for a simple regression algorithm on structured data?
Thanks! | If the problem is the model itself have you tried to explore the model space with AutoKeras 8? | 0 |
tensorflow | General Discussion | How do you prefer to learn how to code with TensorFlow? | https://discuss.tensorflow.org/t/how-do-you-prefer-to-learn-how-to-code-with-tensorflow/34 | Are you a book person? A give-me-a-sample-that-I-can-take-apart person? A video tutorial watcher? Someone who loves to parse deep into the technical docs? Or some combination of all of the above?
What has worked for you in learning TensorFlow, Machine Learning, or indeed anything? | For a scientific topic like Machine Learning (or any academic topic from fluid dynamics to literary linguistics), my approach is usually Full-length video courses + TextBooks.
For a practical platform like TensorFlow I tend to start (phase 1) with a couple (2-5) of video tutorials for a high level overview. I then move to (phase 2) written tutorials that show code samples and explain the code. The more samples and the smoother the progression from simple to more complex the better. After a couple (again 2-5) of tutorials I move to (phase 3) trying to implement a few things relying on documentation (official guide/API docs).
Books sometimes can be part of phase 2 as some books are basically written as very good tutorials (like these 3 here 2). | 0 |
tensorflow | General Discussion | What contributor documentation improvements do you suggest? | https://discuss.tensorflow.org/t/what-contributor-documentation-improvements-do-you-suggest/252 | The TensorFlow team is doing a pass on the contributor documentation we have on tensorflow/tensorflow 7, tensorflow/community 9, and the website 7.
Based on your experience in contributing to TensorFlow, are there any docs that could use improvements for a better experience? Are there any docs that are missing?
Looking forward to your suggestions!
cc @billy for visibility | And also on tensorflow/docs 11 | 0 |
tensorflow | General Discussion | How important is a managed solution for production ML? | https://discuss.tensorflow.org/t/how-important-is-a-managed-solution-for-production-ml/45 | How do you want to run your production ML infrastructure? Do you prefer cloud or on-prem deployments? For cloud, do you prefer managed or self-managed? | This is a great question for a thorough discussion.
I usually prefer the cloud and decide whether or not to use a managed service based on several considerations. First, if the service is supposed to run infrequently at unpredicted times (usually at early stages of an application), I prefer managed services as they give me a predictable cost overview. It also helps me avoid issues caused by cold start in the serverless. I simply dockerize my services and docker-compose-up them with different .env files in dev and prod environments. This seems a bit like hacky but yields a great productivity at early stages.
As my application starts to get attension and have a more regular usage pattern, I start to migrate / upgrade Docker containers to managed services one by one. Finally, I try to implement MLOps best practices for CI/CD/CT.
This workflow helps me remain experimental, fast-prototyping and cost-effective at early stages and then become gradually more robust, tested, scalable and manageable.
I love to hear from others’ experiences in this. | 0 |
tensorflow | General Discussion | A deck on the key trends in computer vision with deep learning | https://discuss.tensorflow.org/t/a-deck-on-the-key-trends-in-computer-vision-with-deep-learning/250 | I wanted to share with you a sneak peek of a deck I have prepared for an upcoming talk. The deck tries to focus on five key trends in computer vision in 2021. Of course, it’s not an exhaustive summary and it largely relates to what I have been mostly working on these days.
Here’s where you can find the deck: https://bit.ly/trends-cv 13. Folks that are a part of the ML-GDE Group can directly comment on the deck.
Aappreciate any feedback. | Nice deck Sayak! Well Done!
I guess you can also add Efficientnet V2 2 to slide 9 later | 0 |
tensorflow | General Discussion | Suggestions regarding loss scaling in a distributed training loop | https://discuss.tensorflow.org/t/suggestions-regarding-loss-scaling-in-a-distributed-training-loop/180 | Hi folks.
I am currently implementing a custom training loop by overriding the train_step() function. I am also not using the default compile() method. So, I believe loss scaling is to be implemented.
Here’s how the fundamental loop is implemented (that runs as expected on a single GPU):
with tf.GradientTape() as tape:
fake_colorized = self.gen_model(grayscale)
fake_input = tf.concat([grayscale, fake_colorized], axis=-1)
predictions = self.disc_model(fake_input)
misleading_labels = tf.ones_like(predictions)
g_loss = - self.loss_fn(misleading_labels, predictions)
l1_loss = tf.keras.losses.mean_absolute_error(colorized, fake_colorized)
final_g_loss = g_loss + self.reg_strength * l1_loss
self.loss_fn is binary cross-entropy.
Here’s how the distributed variant is implemented:
with tf.GradientTape() as tape:
fake_colorized = self.gen_model(grayscale)
fake_input = tf.concat([grayscale, fake_colorized],
axis=-1)
predictions = self.disc_model(fake_input)
misleading_labels = tf.ones_like(predictions)
g_loss = - self.loss_fn(misleading_labels, predictions)
g_loss /= tf.cast(
tf.reduce_prod(tf.shape(misleading_labels)[1:]),
tf.float32)
g_loss = tf.nn.compute_average_loss(g_loss,
self.global_batch_size)
l1_loss = tf.keras.losses.MeanAbsoluteError(
reduction=tf.keras.losses.Reduction.NONE)(colorized,
fake_colorized)
l1_loss /= tf.cast(
tf.reduce_prod(tf.shape(colorized)[1:]),
tf.float32)
l1_loss = tf.nn.compute_average_loss(l1_loss,
self.global_batch_size)
final_g_loss = g_loss + (l1_loss * self.reg_strength)
self.loss_fn is binary cross-entropy but in this case, it’s initialized without any reduction.
This loop is not behaving as expected because the losses are way off. Am I missing out on something? | Are you in the same case as Custom training with tf.distribute.Strategy | TensorFlow Core 1 or is it something different? | 0 |
tensorflow | General Discussion | Suggestions regarding a `tf.data` pipeline | https://discuss.tensorflow.org/t/suggestions-regarding-a-tf-data-pipeline/232 | I am currently using the RandAugment class from tf-models (from official.vision.beta.ops import augment). The RandAugment().distort(), however, does not allow batched inputs, and computation-wise it’s expensive as well (especially when you have more than two augmentation operations).
So, following suggestions from this guide 4, I wanted to be able to map RandAugment().distort() after my dataset is batched. Any workaround for that?
Here’s how I am building my input pipeline for now:
# Recommended is m=2, n=9
augmenter = augment.RandAugment(num_layers=3, magnitude=10)
dataset = load_dataset(filenames)
dataset = dataset.shuffle(batch_size*10)
dataset = dataset.map(augmenter.distort, num_parallel_calls=AUTO) | Yes the issue is that It seems to me that we have also duplicated OPS like e.g. cutout not batched in official.vision namespace and batched in TFA 3.
These are the origins of the current status:
github.com/tensorflow/addons
Migrate AutoAugment and RandAugment to TensorFlow Addons. 2
opened
Mar 5, 2020
closed
May 28, 2020
dynamicwebpaige
Describe the feature and the current behavior/state.
RandAugment and AutoAugment are both policies for enhanced image preprocessing that are included in EfficientNet,...
Feature Request
help wanted
image
github.com/tensorflow/community
Ask contribution to Tensorflow addons for general scope utils, loss, layers, ops 1
opened
Apr 1, 2020
bhack
As we have just refreshed the model repo as model garden I would enforce the contributions policies of generale use (or... | 0 |
tensorflow | General Discussion | How do you decide when to retrain your production models? | https://discuss.tensorflow.org/t/how-do-you-decide-when-to-retrain-your-production-models/46 | How do you decide when to retrain your production models? Do you just always retrain them on a schedule, whether they need it or not, or do you monitor and evaluate your model’s performance in production? | One common practice I saw, is to collect a new (typically small) test set every few weeks (weekly is not uncommon) and use that to monitor if model performance is dropping consistently over time. If that is the case, it is typical to set a threshold on the drop. Once that drop threshold is reached, a new training set is compiled and new models are trained. Both old and new test sets can be used to compare new models with current production model.
I’ve also seen teams adopt a fixed retraining schedule, but only when they know from long experience that such drift does happen for their particular application.
There are some fancy methods for monitoring distribution drift but they can be deceiving as some drifts won’t actually affect the model performance. | 0 |
tensorflow | General Discussion | What model(s) for a sequence of human poses? | https://discuss.tensorflow.org/t/what-model-s-for-a-sequence-of-human-poses/120 | Hi!
I would like to recognize a sequence of human poses, with a predefined timing. For example: recognize a tennis serve, a soccer kick, a ballet move, etc.
I have looked at pose similarity for single pose comparison here (https://blog.tensorflow.org/2018/07/move-mirror-ai-experiment-with-pose-estimation-tensorflow-js.html 4).
Is there a recommended model for a sequence of poses (LSTM?). I would also like to identify the deviation from ideal poses and timing (i.e. too early/late for this pose).
Thanks! | It’s a great quesiton, and I’d love to know the answer too!
I’m thinking multiple models would have to be used.
One is pose detection which captures a sequence of poses over time.
One is a sequence model, trained on sequences of poses to classify them as ‘good’ or ‘bad’ or some other label.
At runtime you then capture the sequence using the posenet, pull out the relevant parts of the skeleton, and feed that into the sequence model to get a classification. | 0 |
tensorflow | General Discussion | Tell me your funny (SFW) Machine Learning stories? | https://discuss.tensorflow.org/t/tell-me-your-funny-sfw-machine-learning-stories/35 | Would love to hear funny stories about your ML implementations. What kind of bugs have you encountered?
One of my favorites – not sure if it’s true or not – was that a few years back the US Army wanted to build a computer vision model to detect camouflaged tanks. They got some data scientists to build a model, and these folks got to borrow a tank for a couple of days, drive it around the woods, and take lots of pictures. One day they did it without camo and labelled it. The next day they got the camo nets and did the same. They built a model with these pictures, and did everything right – holding back a portion for testing and validation. When they were done, their model was incredibly accurate. They had succeeded!
Then they went into the field to test it. And it failed, miserably. They couldn’t figure out why. Their test set and validation sets were properly selected and randomized. It should work.
And then somebody pointed out that the weather was sunny on day 1 (no camo), and cloudy on day 2 (with camo) , so instead of a camo detector, they had actually built a cloudy sky detector instead… | This reminds me of an actual experience I had a few years ago. I was training a reinforcement learning robot to navigate a (simulated) maze. This was for a competition at my university. The organizers provided us with an API where we would get a maze layout and the position of the robot and several exit points and “treasure” locations. Goal was to have robot leave the maze before a timer expired but the ranking was based on how much treasure you got.
After several hours of training, I got a robot which could navigate all the mazes that were generated by the API, getting good exploration-exploitation balance. Then, we decided to train the pipeline so that instead of using the maze as provided by the API we used a rotation of it. Turns out the robot was getting stuck most of the time.
The reason? The maze generation algorithm that was provided in the API was biased to mazes that had long horizontal corridors and very short passages to next rows. So our robot was overfitting on this feature.
It was easy to fix and it turns out the organizers also fixed this in the generator for the actual competition. So only a few number of robots managed to score points during the actual event, as those teams put extra care towards preventing overfitting to the training data. | 0 |
tensorflow | General Discussion | How to audit courses on Coursera for Free | https://discuss.tensorflow.org/t/how-to-audit-courses-on-coursera-for-free/110 | We have lots of courses on Coursera, and we get lots of questions from folks that don’t want to sign in and pay to get a certificate, and just want to audit.
This is possible. It’s subtle, but possible – here are the details.
The audit option will give you the full content of the courses, but you will not earn the certificates for completing them.
Note the Coursera terminology. A specialization is a collection of courses. Specializations may not be audited. However, each of the individual courses within the specialization may be!
Below are links to each of these courses within their specialization.
To access them in audit, select the course, and then click on ‘enroll for free’.
Screen Shot 2021-02-22 at 5.26.44 PM866×392 43.8 KB
You’ll see a dialog like this. Important: Note the ‘Audit the Course’ link at the bottom. Do not select ‘Start Free Trial’.
Screen Shot 2021-02-22 at 5.28.31 PM660×578 76 KB
This will give you full access to the content.
Below are each of the specializations, and I’ve put direct links to the courses within them. Follow the above process with these links to access them at no cost.
TensorFlow: In Practice Specialization
Introduction to TensorFlow for Artificial Intelligence, Machine Learning, and Deep Learning 6
Convolutional Neural Networks in TensorFlow 4
Natural Language Processing in TensorFlow 6
Sequences, Time Series and Prediction 7
TensorFlow: Data and Deployment Specialization
Browser-based Models with TensorFlow.js 2
Device-based Models with TensorFlow Lite 3
Data Pipelines with TensorFlow Data Services 3
Advanced Deployment Scenarios with TensorFlow 5
AI for Medicine Specialization
AI for Medical Diagnosis 2
AI for Medical Prognosis 3
AI For Medical Treatment 5
Natural Language Processing Specialization
Natural Language Processing with Classification and Vector Spaces 8
Natural Language Processing with Probabilistic Models 2
Natural Language Processing with Sequence Models 6
Natural Language Processing with Attention Models 3 | Also the Advanced TensorFlow specialization:
TensorFlow: Advanced Techniques Specialization 6
Custom Models, Layers, and Loss Functions with TensorFlow 3
Custom and Distributed Training with TensorFlow 5
Advanced Computer Vision with TensorFlow 5
Generative Deep Learning with TensorFlow 6 | 0 |
tensorflow | General Discussion | Any experience (good or bad) using TF for unsupervised learning? | https://discuss.tensorflow.org/t/any-experience-good-or-bad-using-tf-for-unsupervised-learning/125 | Having used many unsupervised learning algorithms in the past as part of my development pipeline, I was wondering about weather there are good implementations out there that are built on top of TensorFlow (I’ve seen a couple of k-means implementations in tutorial format, but not much more).
What tools other than TensorFlow do you use for your unsupervised learning needs? | I have been using TensorFlow for coding up a number of different self-supervised models for vision and the experience have been great (and easy). Feel free to take a look into the following minimal implementations of popular self-supervised methods for vision:
SimCLR 6
SwAV 5
SimSiam 2
Sorry, could not post links because the forum does not yet allow it. | 0 |
tensorflow | General Discussion | TensorFlow Book suggestions | https://discuss.tensorflow.org/t/tensorflow-book-suggestions/112 | Great book suggestions to learn TensorFlow | Let me start with a very good one if you are starting with Machine Learning and is already a developer:
AI and Machine Learning for Coders PXL_20201229_1625560064032×3024 1.85 MB
It’s very easy to follow and shows some good use cases and a lot of hands on code to try. | 0 |
tensorflow | General Discussion | What OS do you primarily use TensorFlow on? | https://discuss.tensorflow.org/t/what-os-do-you-primarily-use-tensorflow-on/126 | What operating system do you use TensorFlow on? Linux MacOS Windows Other30votersShow results | I’d add Colab as an option (or maybe the Browser). I know it’s not a OS but it’s my main IDE as of these days | 0 |
tensorflow | Show and Tell | Official #MadeWithTFJS Show & Tell inspiration thread | https://discuss.tensorflow.org/t/official-madewithtfjs-show-tell-inspiration-thread/36 | Once per quarter we meet with several members from the TensorFlow.js community to learn more about what amazing projects they have created. This thread is the one stop place to see the latest interviews to get inspiration of what is possible using Machine Learning in JavaScript across front end (browser), back end (Node.js), React Native (native app), Electron (desktop), and even IOT (Raspberry Pi via Node). Check back regularly!
To kick things off, here is our first video interview:
Enjoying the show with Gant Laborde who explains how he solved a problem when presenting digitally to an audience where he was unable to know if they were interested in the content being presented. Learn how Gant created an innovative, real-time, and scalable system to better understand his audience using machine learning in the browser using TensorFlow.js. | Real-time semantic segmentation in the browser with Hugo Zanini - a Python developer who was looking to use the latest cutting edge research from the TensorFlow community in the browser using JavaScript. Join us as Hugo takes us through his learning experiences in using SavedModels in an efficient way in JavaScript directly enabling you to get the reach and scale of the web for your new research. | 0 |
tensorflow | Show and Tell | About the Show and Tell category | https://discuss.tensorflow.org/t/about-the-show-and-tell-category/16 | Got a cool project? Share and show off your work.
Feel free to share links to demos, GitHub and posts for your project. You can also submit your project 13 to the TensorFlow Community Spotlight program for the chance to be featured on the TensorFlow Twitter handle. | I worked on various Pre-trained Machine Learning Models on Raspberry Pi. These are computer vision models (Inception and Mobilenets) provided by the Google Coral team.
Though they have provided examples to run these models using sample scripts, I thought it would be a nice idea to make a simple tool using Python & Web dev which can run these 20+ models without having to stop and start the Python script every time you need to test a different model. Further, the tool takes care of Object Detection and Image classification methods dynamically and provides output accordingly.
To simplify the installation process, I have written a bash script using which anyone can configure his/her Raspberry Pi in all respects to run this project. The script automatically installs Tensorflow Lite, OpenCV, all the models and source code of this project on a Raspberry Pi. Basically, a beginner can start seeing the output without having to see the code or worry about it.
I named the tool ‘Model Garden’ and I think it will be useful for students / hobbyists to get started with Machine Learning on a Raspberry Pi or atleast have a feel of these wonderful models without much hassle.
Check this on Github:-
jiteshsaini/model_garden | 0 |
tensorflow | Show and Tell | Implementing “Augmenting convolutional networks with attention-based aggregation” | https://discuss.tensorflow.org/t/implementing-augmenting-convolutional-networks-with-attention-based-aggregation/7329 | In my latest keras example I minimally implement “Augmenting Convolutional networks with attention-based aggregation” by Touvron et. al.
The main idea is to use a non-pyramidal convnet architecture and to swap the pooling layer with a transformer block. The transformer block acts like a cross-attention layer that helps in attending to feature maps that are useful for a classification decision.
The attention-maps from the transformer block helps in the interpretability of the model. It let’s us know which part (patch) of the image is the model really focused on when making a classificaiton decision.
Link to the tutorial: Augmenting convnets with aggregated attention
@Ritwik_Raha, @Devjyoti_Chakraborty and I have built a Hugging Face demo around this example for all of you to try. In the demo we use a model that was trained on the imagenette dataset.
image1732×886 126 KB
Link to the demo: Augmenting CNNs with attention-based aggregation - a Hugging Face Space by keras-io 2
I would like to thank JarvisLabs.ai for providing me with GPU credits for this project. | Just tried, amazing.
image1496×748 68.1 KB | 0 |
tensorflow | Show and Tell | Wrap up of Advent of Code 2021 in pure TensorFlow | https://discuss.tensorflow.org/t/wrap-up-of-advent-of-code-2021-in-pure-tensorflow/7185 | An article that briefly recaps all the challenges faced solving half of the advent of code 2021 challenges in pure TensorFlow and allows you to browse them easily.
P. Galeone's blog
Wrap up of Advent of Code 2021 in pure TensorFlow 8
A wrap up of my solutions to the Advent of Code 2021 puzzles in pure TensorFlow | This is very interesting!
I thought it was already challenge to solve all the problems with regular Python! | 0 |
tensorflow | Show and Tell | New, clean implementation of Faster R-CNN in both TensorFlow 2/Keras and PyTorch | https://discuss.tensorflow.org/t/new-clean-implementation-of-faster-r-cnn-in-both-tensorflow-2-keras-and-pytorch/7179 | Hi everyone,
I recently put the finishing touches on my Faster R-CNN self-learning exercise. My goal was to replicate the model from scratch using only the paper. That was a bit ambitious and I had to eventually relent and peek at some existing implementations to understand a few things the paper is unclear on. The repo is here: GitHub - trzy/FasterRCNN: Clean and readable implementations of Faster R-CNN in PyTorch and TensorFlow 2 with Keras. 3
I wrote both a PyTorch and a TensorFlow implementation. I’d like to think they are pretty clean, readable, and easy to use. I also documented some of my struggles and takeaways in the README.md file.
One thing that continues to bother me is the need for an additional tf.stop_gradient() in the regression loss functions surrounding a tf.less statement. The function itself is differentiable. The PyTorch version doesn’t need this. I might make a post about it on one of the other sub-forums because I stumbled upon the solution by accident. Without the explicit stop_gradient, the model still learns, but achieves significantly lower precision. Would love to learn about how others would approach debugging such an issue.
Thanks,
Bart | @Bart great. You made a lot of effort out there, starred. A small request, in your read-me there’s a lot of development details which can be separated as another .md. In this way, the front read-me.md can give more top-level highlights for example how-to-reproduce, how-to-fine-tune- or how-to-train-from-scratch-on-custom-data, etc. | 0 |
tensorflow | Show and Tell | Grad-cam cnn vs hybrid-swin transformer | https://discuss.tensorflow.org/t/grad-cam-cnn-vs-hybrid-swin-transformer/7071 | I was checking the grad-cam of a pure cnn and a hybrid model (cnn+swin_transformer). Now, after passing an intermediate layer from CNN to Swin-transformer, it looks like the transformer blocks are able to refine the feature activation globally across the relevant object; unlike CNN which is more interested to operate locally.
(left: input, – middle: CNN, – right: CNN + Transformer / Hybrid).
Code example: TF: Hybrid EfficientNet Swin-Transformer : GradCAM | Kaggle 4 | Nice, It could be interesting to visualize also:
GitHub
GitHub - google-research/vmoe
Contribute to google-research/vmoe development by creating an account on GitHub. | 0 |
tensorflow | Show and Tell | Train a Vision Transformer on small datasets | https://discuss.tensorflow.org/t/train-a-vision-transformer-on-small-datasets/7023 | ViTs are data hungry, pretraining a ViT on a large-sized dataset like JFT300M and fine-tuning it on medium-sized datasets (like ImageNet) is the only way to beat state-of-the-art Convolutional Neural Network models.
The self-attention layer of ViT lacks locality inductive bias (the notion that image pixels are locally correlated and that their correlation maps are translation-invariant). This is the reason why ViTs need more data. On the other hand, CNNs look at images through spatial sliding windows, which helps them get better results with smaller datasets.
In my latest keras example I minimally implement the academic paper Vision Transformer for Small-Size Datasets. Here the authors set out to tackle the problem of locality inductive bias in ViTs by introducing two novel ideas:
Shifted Patch Tokenization (SPT): A tokenization scheme which allows for a greater receptive field for the transformer.
image832×400 94.6 KB
Locality Self Attention (LSA): A tweaked version of the multi head self attention mechanism. Applying a diagonal mask and a learnable temperature quotient to the regular self attention, we get our LSA. Inheriting the tf.keras.layers.MultiHeadAttention and tweaking the API was my greatest win while implementing LSA.
image1200×709 63.5 KB
Tutorial: Train a Vision Transformer on small datasets 9 | Amazing Thank you | 0 |
tensorflow | Show and Tell | ResNet-RS rewritten in Tensorlfow/Keras | https://discuss.tensorflow.org/t/resnet-rs-rewritten-in-tensorlfow-keras/5733 | Hello Community!
I’m sharing a personal project of mine, which was to rewrite ResNet-RS models from TPUEstimator to Tensorflow/Keras.
GitHub
GitHub - sebastian-sz/resnet-rs-keras: ResNet-RS models rewritten in... 49
ResNet-RS models rewritten in Tensorflow / Keras functional API. - GitHub - sebastian-sz/resnet-rs-keras: ResNet-RS models rewritten in Tensorflow / Keras functional API.
Features:
Automatic weights download.
Transfer learning possible.
pip install directly from GitHub.
keras.applications like usage.
Use like any other Tensorflow/Keras model!
Other links:
Original repository 5
Arxiv Link
Let me know what you think! | Nice work, I really appreciate the “thoroughness”, especially TFLite support and Docker | 0 |
tensorflow | Show and Tell | Implementing DeepMind’s new Perceiver Model | https://discuss.tensorflow.org/t/implementing-deepminds-new-perceiver-model/1111 | I am glad to present an implementation of DeepMind’s new “Perceiver: General Perception with Iterative Attention” Model which builds on top of Transformers but solves the quadratic scaling problem without making any assumptions of the data like the previous approaches in TensorFlow. This means you can use the same model on images, audio, videos, etc! This model also achieves state-of-the-art for some tasks!
Find it here:
github.com
Rishit-dagli/Perceiver 71
Implementation of Perceiver, General Perception with Iterative Attention in TensorFlow | Nice, we have also a tutorial/example for image classification with Perceiver on the Keras doc website
keras.io
Keras documentation: Image Classification with Perceiver 74
If you have any feedback/PR to improve the tutorial it is very appreciated. | 0 |
tensorflow | Show and Tell | Continuous Adaptation for Machine Learning System to Data Changes | https://discuss.tensorflow.org/t/continuous-adaptation-for-machine-learning-system-to-data-changes/6273 | @deep-diver and I have worked on an MLOps project for the past couple of months. It shows how “Continuous Adaptation for ML System to Data Changes” can be done by building/interconnecting two separate pipelines (note this project is done in TFX and various GCP services).
image1600×799 125 KB
We have written a blog post about some of the internal implementation details, and it is published on TensorFlow Blog. Please find it here:
blog.tensorflow.org
Continuous Adaptation for Machine Learning System to Data Changes 4
Learn how ML models can continuously adapt as the world changes, avoid issues, and take advantage of new realities in this guest blog post.
Also, we have open-sourced all the materials to reproduce this project including in-depth explanations within a set of Jupyter notebooks. You can find the repo here
GitHub
GitHub -... 1
Contribute to deep-diver/Continuous-Adaptation-for-Machine-Learning-System-to-Data-Changes development by creating an account on GitHub.
@Robert_Crowe, huge thanks for your help on this one.
Thanks for your valuable time to read this and we hope this will be helpful | Thanks it is a nice tutorial, It could be interesting one day to expand this to cover:
some state of the art continual learning approaches instead of retraining the whole model.
to handle the drift in an openset/openworld context 2 instead of just a misclassification threshold in the closed set classes. | 0 |
tensorflow | Show and Tell | I implemented Transformer in Transformer in TensorFlow | https://discuss.tensorflow.org/t/i-implemented-transformer-in-transformer-in-tensorflow/6327 | I implemented the very recent NeurIPS 21 paper Transformer in Transformer in TensorFlow which uses attention inside local patches essentially using pixel level attention paired with patch level attention. This also achieves SoTA performance on image classification beating ViT and DeiT with similar computational cost.
GitHub
GitHub - Rishit-dagli/Transformer-in-Transformer: An Implementation of... 11
An Implementation of Transformer in Transformer for image classification, attention inside local patches - GitHub - Rishit-dagli/Transformer-in-Transformer: An Implementation of Transformer in Tran... | github.com/keras-team/keras-io
Update an example on transformer_in_transformer 4
keras-team:master ← czy00000:master
opened
Nov 6, 2021
czy00000
+357
-0
sove the problem of this PR #687 | 0 |
tensorflow | Show and Tell | Masked Autoencoders for self-supervised pretraining of images | https://discuss.tensorflow.org/t/masked-autoencoders-for-self-supervised-pretraining-of-images/6099 | Hi folks,
I hope you are doing well. Since last year, the computer vision community experienced a boom in self-supervised pertaining methods for images. While most of these methods share common recipes (augmentation, projection head, LR schedules, etc.)
reconstruction-based pertaining methods differ from them and make the process simpler and more scalable. Such a method is Masked Autoencoding released a couple of days ago from FAIR. Today, we (@ariG23498 and myself) are happy to share a pure TensorFlow implementation of the method along with commentary and promising results:
Masked image modeling with Autoencoders 12.
It is along similar lines to BERT’s pretraining objective: masked language modeling.
Some advantages of this method:
Does not rely upon sophisticated augmentation transforms
Easy to implement (barring a few nuts and bolts)
Quite faster pre-training
Implicit handling of representation collapse
On par with SoTA for self-supervision in the field of computer vision
I hope you folks will find the article useful and as always, we are happy to answer questions. | Sayak_Paul:
,
Great work on this Sayak, this will definitely be useful for many.
Small thing, but the keras page is future dated. But this is so cool it might as well be in the future | 0 |
tensorflow | Show and Tell | Zero-DCE TensorFlow Lite Model | https://discuss.tensorflow.org/t/zero-dce-tensorflow-lite-model/5984 | Have you ever wondered how to convert your dark images into better photos? Now you can do it in one second, with the help of the Zero-DCE model. The TF-Lite model is available on TensorFlow Hub. Now you can effortlessly deploy this Deep Learning model on your edge devices to get amazing images as output.
Thanks to Soumik Rakshit 1 for building the Zero-DCE model, Sayak Paul 1 and Tulasi Ram Laghumavarapu 1 for guiding me while contributing to TensorFlow Hub.
TensorFlow Hub Link: TensorFlow Hub 1
References
Zero-DCE paper link: https://arxiv.org/pdf/2001.06826.pdf
Zero-DCE Original Repository: GitHub - soumik12345/Zero-DCE: Pytorch implementation of Zero-Reference Deep Curve Estimation for Low-Light Image Enhancement
Zero-DCE Keras Example: Zero-DCE for low-light image enhancement 1
Zero-DCE TF-Lite Repository: GitHub - sayannath/Zero-DCE-TFLite: Conversion of TF-Lite model from ZERO-DCE model 4
PS: My first contribution to TensorFlow Hub | Congrats Sayan!
Very nice work overall! Mainly the TFHub model publishing! | 0 |
tensorflow | Show and Tell | Neural Style Transfer with AdaIN | https://discuss.tensorflow.org/t/neural-style-transfer-with-adain/5759 | Neural Style Transfer as proposed by Gatys et. al. was a slow and iterative method that could not transfer style in real time. With Adaptive Instance Normalization 1 we achieve arbitrary style transfer in real time.
Our (with @Ritwik_Raha) Keras blog post on AdaIN got published.
Link: Neural Style Transfer with AdaIN 1
The post is also accompanyed by a hugging face demo for you all to try the models out.
Hugging face demo: Neural Style Transfer using AdaIN - a Hugging Face Space by ariG23498 1
Hope this example turns out to be a good addition to the community.
Results
Style Transfer Image546×1661 1.21 MB | Nice work Ari!!
Why don’t you publish these models also on TensorFlow Hub? | 0 |
tensorflow | Show and Tell | Model training as a CI/CD system | https://discuss.tensorflow.org/t/model-training-as-a-ci-cd-system/5341 | Hi folks,Continuous integration and deployment (CI/CD) is a common topic of discussion when it comes to DevOps. No wonder why it has also become so for MLOps. With MLOps though, we have another piece of continuity - continuous re-training and evaluation.
In our latest two-part article from the GCP blog, @deep-diver and I dive deep into incorporating CI/CD for ML with TensorFlow, TFX, and Vertex AI along with other services from GCP. We take the scenario where we need to incorporate code changes (be it for better training techniques or better model architectures) for an ML system and perform CI/CD in a meaningful manner. Below are the links:
Model training as a CI/CD system (Part I): Code 14 | Blog Post 27
Model training as a CI/CD system (Part II): Code 2 | Blog Post 6
Happy to answer q’s. | @Sayak_Paul
CI/CD tool(cloud build or github action here) always starts from clean state with fresh container. That means there is no existing pipeline, but you can do update if you are using a dedicated stateful server. | 1 |
tensorflow | Show and Tell | Adaptive Instance Normalization | https://discuss.tensorflow.org/t/adaptive-instance-normalization/1942 | Adaptive Instance Normalization 7 was a great read. Here the authors argue that instance normalization is indeed style normalization.
With that in mind, they provide a faster and more versatile approach to neural style transfer.
My take: GitHub - ariG23498/AdaIN-TF: Minimal Implementation of AdaIN with TensorFlow 30 | Built a hugging face space for this project.
Link: Neural Style Transfer using AdaIN - a Hugging Face Space by ariG23498 3
Worked on it with @Ritwik_Raha. | 0 |
tensorflow | Show and Tell | Distributed Training in TensorFlow with AI Platform & Docker | https://discuss.tensorflow.org/t/distributed-training-in-tensorflow-with-ai-platform-docker/255 | Hi folks,
I am pleased to share my latest blog post with you: Distributed Training in TensorFlow with AI Platform & Docker.
Sayak Paul – 6 Apr 21
Distributed Training in TensorFlow with AI Platform & Docker 17
Training a model using distributed training with AI Platform and Docker.
It will walk you through the steps of running distributed training in TensorFlow with AI Platform training jobs and Docker. Below, I explain the motivation behind this blog post:
If you are conducting large-scale training it is likely that you are using a powerful remote machine via SSH access. So, even if you are not using Jupyter Notebooks, problems like SSH pipe breakage, network teardown, etc. can easily occur. Consider using a powerful virtual machine on Cloud as your remote. The problem gets far worse when there’s a connection loss but you somehow forget to turn off that virtual machine to stop consuming its resources. You get billed for practically nothing when the breakdown happens until and unless you have set up some amount of alerts and fault tolerance.
To resolve these kinds of problems, we would want to have the following things in the pipeline:
A training workflow that is fully managed by a secure and reliable service with high availability.
The service should automatically provision and de-provision the resources we would ask it to configure allowing us to only get charged for what’s been truly consumed.
The service should also be very flexible. It must not introduce too much technical debt into our existing pipelines.
Happy to address any feedback. | Nice, another solution that we have is Tensorflow-cloud 11 | 0 |
tensorflow | Show and Tell | New TF Hub Collection: ConvMixer Models | https://discuss.tensorflow.org/t/new-tf-hub-collection-convmixer-models/5458 | I contributed this collection containing 6 different ConvMixer models that were pre-trained on the ImageNet-1K dataset available for fine-tuning as well as image classification. Further, the models are also accompanied with a tutorial to help you get started in <5 minutes.
ConvMixer is a simple model that uses only standard convolutions to achieve the mixing steps. Despite its simplicity, ConvMixer outperforms ViT and MLP-Mixer. ConvMixer relies directly on patches as input, separates the mixing of spatial and channel dimensions and maintains equal size and resolution throughout the network.
https://tfhub.dev/rishit-dagli/collections/convmixer 8
The associated GitHub repo could be found here:
github.com
GitHub - Rishit-dagli/ConvMixer-torch2tf: This repository hosts code for... 7
This repository hosts code for converting the original ConvMixer models (PyTorch) to TensorFlow. - GitHub - Rishit-dagli/ConvMixer-torch2tf: This repository hosts code for converting the original C...
You might want to take a look at a ConvMixer implementation by @Sayak_Paul here 2 and by @sayannath235 here 3. | This is very cool Rishit!
Thanks for contributing to TFHub and helping the community have access newer models! | 0 |
tensorflow | Show and Tell | Image classification with MobileViT | https://discuss.tensorflow.org/t/image-classification-with-mobilevit/5247 | Combining the benefits of convolutions (for spatial relationships) and transformers (for global relationships) is an emerging research trend in computer vision. In my latest example, I present the MobileViT architecture (Mehta et al. 1) that presents a simple yet unique way to reap benefits of the two.
With about a million parameters, it achieves a top-1 accuracy of ~86% on the tf_flowers dataset on 256x256 resolution. Furthermore, the training recipes are simple and the model runs efficiently on mobile devices (which is atypical for transformer-based models).
keras.io
Keras documentation: MobileViT: A mobile-friendly Transformer-based model for... 28 | That’s amazing! Great work as always | 0 |
tensorflow | Show and Tell | Point cloud segmentation in the wild | https://discuss.tensorflow.org/t/point-cloud-segmentation-in-the-wild/5358 | A “point cloud” is an important type of data structure for storing geometric shape data. Due to its irregular format, it’s often transformed into regular 3D voxel grids or collections of images before being used in deep learning applications, a step that makes the data unnecessarily large.
In our latest example (Soumik and myself), we present PointNet (from 2017) solves this problem by directly consuming point clouds, respecting the permutation-invariance property of the point data. Additionally, we’re working on a comprehensive repository on performing point cloud segmentation at scale with full TPU support.
image560×558 96.6 KB
Keras example: Point cloud segmentation with PointNet 10
GitHub repo: https://git.io/Jidna 5 | This is great!
Nice work! | 0 |
tensorflow | Show and Tell | New Keras Example: Image classification with Swin Transformers | https://discuss.tensorflow.org/t/new-keras-example-image-classification-with-swin-transformers/4400 | Here goes my next Keras Example all about implementing Swin Transformers, a general-purpose backbone for computer vision. The Swin Transformer architecture for image classification – a Transformer-based vision model that uses local self-attention as a way to make self-attention on images linear in complexity. I go on to demonstrate using this for image classification on CIFAR-100.
keras.io
Keras documentation: Image classification with Swin Transformers 51 | PS: After your wonderful suggestion, @lgusm , I am already in works to publish the trained model on TF Hub. | 0 |
tensorflow | Show and Tell | Rock, paper, scissors game powered by MobileNetV2 | https://discuss.tensorflow.org/t/rock-paper-scissors-game-powered-by-mobilenetv2/5280 | I have recently finalized my project and decided to share with you
It’s rock, papar, scissors game powered by the MobileNetV2 model and deployed completely server-less with Tensorflow.js:
romaglushko.com
Rock, Paper, Scissors Game - Lab by Roman Glushko 13
Rock, paper, scissors online game powered by Machine Learning
There is a demo of the game where you can try it and the full story how I built the project. Hope you will have a great time checking it out | Welcome to the forum and thank you for sharing your TensorFlow.js demo! Always great to see what folk are up to. I actually did something similar a few years back (but was not TensorFlow.js) where I recorded a GIF of myself and was able to make it look like you were playing a real person - you may be able to update your version to do something similar too:
Rock Paper Scissors - Machine Learning Style using Tensor Flow
You can see in the bottom left the live view in the last second when you show your hands, and the large GIF is the “computer”. My version here used websockets to transmit the final frame to web server for classification which is certainly less elegant than a pure TensorFlow.js solution, but it did not exist back when I made this
Look forward to seeing how your project (or future projects) evolve! Thanks for being part of the #madeWithTFJS community! | 0 |
tensorflow | Show and Tell | A new notebook: Structured Data Classification using TensorFlow Decision Forests | https://discuss.tensorflow.org/t/a-new-notebook-structured-data-classification-using-tensorflow-decision-forests/4812 | Hi everyone,
As part of Kaggle’s " Tabular Playground Series - Sep 2021", I created a notebook using TensorFlow Decission Forests.
If you’re interested, check it out please and let me know if you have any ideas on how to make it better and enhance it.
colab.research.google.com
Google Colaboratory 103
Regards,
Fadi Badine | Another super cool example! Thank you @Fadi_Badine! | 0 |
tensorflow | Show and Tell | Finding similar questions via contrastive learning using QA dataset | https://discuss.tensorflow.org/t/finding-similar-questions-via-contrastive-learning-using-qa-dataset/4806 | Hi, there.
I developed a model to find similar questions or answers via contrastive learning, and I think I got a good result in a new way. So I want to share my codes and results here.
The idea is very simple; similar questions should be answered similarly. So I built a model that encodes question texts and finds appropriate answers in a contrastive objective. After the training, I could find similar questions using the trained encoder.
github.com
GitHub - jeongukjae/question-similarity: Find similar questions via contrastive... 3
Find similar questions via contrastive learning. Contribute to jeongukjae/question-similarity development by creating an account on GitHub. | @Divvya_Saxena I removed the help_request tag because this post is not for requesting help. But thanks for updating the other tags! | 0 |
tensorflow | Show and Tell | Learning Machine Learning in 30+ Notebooks (TensorFlow and other ML tools included) | https://discuss.tensorflow.org/t/learning-machine-learning-in-30-notebooks-tensorflow-and-other-ml-tools-included/4660 | I am releasing a comprehensive repository containing 30+ notebooks on Python programming, data manipulation, data analysis, data visualization, data cleaning, classical machine learning, Computer Vision, and Natural Language Processing(NLP).
git_cover1280×640 127 KB
Here is the link 33 for the repo. The easiest way of reviewing the notebooks is through Nbviewer 4.
For Deep Learning with TensorFlow specific repo, here is the link 9. And to review the notebooks here 4. | Thanks for sharing Jean! | 0 |
tensorflow | Show and Tell | Reminder! TensorFlow Community Spotlight Program | https://discuss.tensorflow.org/t/reminder-tensorflow-community-spotlight-program/4586 | Are you doing great things with TensorFlow? If you have a cool TensorFlow project you’d like us to review for a chance to be featured on our #TFCommunitySpotlight 5 channel and win some TF swag, you can submit it here: goo.gle/tfcs 8
Check out our most recent winner’s project @Sayak_Paul @ goo.gle/3AxVn5Y 9
twitter.com
TensorFlow (TensorFlow) 5
🏅Congratulations to #TFCommunitySpotlight winner, Sayak Paul (ML GDE)!
Sayak’s project provides a systematic way to compress bigger models into smaller ones allowing developers to serve them at lower costs. Great job!
Check it out → https://t.co/R4zeX6oOOn
12:07 PM - 19 Aug 2021
128
23 | I didn’t know that it received the award :o I thought I’d get tagged. But anyway, thank you! | 0 |
tensorflow | Show and Tell | New GCP Blog: Dual Deployments on Vertex AI | https://discuss.tensorflow.org/t/new-gcp-blog-dual-deployments-on-vertex-ai/4558 | @deep-diver and I have been constantly working on MLOps projects, and we want to share one of our latest works with you guys, “Dual Deployments on Vertex AI”. We leverage several components from the ML tooling provided by Google such as TensorFlow, TFX, Vertex AI, Cloud Build, and so on.
Dual Deployments is a common machine learning design pattern.
image1102×938 123 KB
As described in the blog post, it can be applied to two scenarios of online/offline predictions and layered predictions.
In this blog post, we introduce two different approaches on how to write a machine learning pipeline to realize the dual deployment pattern.
TFX + custom model based approach
: DenseNet for cloud and MobileNet v3 for mobile deployments.
KFP + GCP’s AutoML based approach
: AutoML for cloud and AutoML Edge for mobile deployments.
In both cases, you can find out how custom components can be written including
At the time of writing the blog post, TFX didn’t support uploading/hosting trained models on Vertex AI, so we wrote ones ourselves.
For mobile deployment, we wrote a custom component to publish the TFLite model to Firebase ML.
If you find this brief description interesting, please find more information:
GCP Blog Post: Dual deployments on Vertex AI | Google Cloud Blog 3
GitHub Repo: https://github.com/sayakpaul/Dual-Deployments-on-Vertex-AI 1 | Congrats Sayak and Chansung for the detailed post!!
The TF community is just amazing!!! | 0 |
tensorflow | Show and Tell | Reducing the parameter size of LaBSE(language-agnostic BERT Sentence Embedding) for practical usage | https://discuss.tensorflow.org/t/reducing-the-parameter-size-of-labse-language-agnostic-bert-sentence-embedding-for-practical-usage/4418 | To get good quality language-agnostic sentence embeddings, LaBSE is a good choice. But due to the parameter size(Bert-base size, but #param is 471M), it is hard to fine-tune/deploy appropriately in a small GPU/machine.
So I applied the method of the paper “Load What You Need: Smaller Versions of Multilingual BERT” to get the smaller version of LaBSE, and I can reduce LaBSE’s parameters to 47% without a big performance drop using TF-hub and tensorflow/models.
GitHub: https://github.com/jeongukjae/smaller-labse 15
Relative Links:
Language-agnostic BERT Sentence Embedding(LaBSE) (Paper: [2007.01852] Language-agnostic BERT Sentence Embedding, TF-hub:TensorFlow Hub 1)
Load What You Need: Smaller Versions of Multilingual BERT (Paper: [2010.05609] Load What You Need: Smaller Versions of Multilingual BERT 1, GitHub: https://github.com/Geotrend-research/smaller-transformers 1) | Nice work Jeon!!
Does the preprocessing model still works with your model? or is there still a need for it?
Did you think about publishing this to TFHub too? | 0 |
tensorflow | Show and Tell | Pre-trained model | https://discuss.tensorflow.org/t/pre-trained-model/4238 | tensorflow modifies the input channel of the pre-trained model | Hi Weizhi.
Can you explain in more details what issue are you facing? maybe with some code. | 0 |
tensorflow | Show and Tell | Implementing Fastformer: Additive Attention Can Be All You Need | https://discuss.tensorflow.org/t/implementing-fastformer-additive-attention-can-be-all-you-need/4135 | I am glad to present my implementation of the “Fastformer: Additive Attention Can Be All You Need” paper.
This is a Transformer variant based on additive attention that can handle long sequences efficiently with linear complexity. Fastformer is much more efficient than many existing Transformer models and can meanwhile achieve comparable or even better long text modeling performance.
github.com
GitHub - Rishit-dagli/Fast-Transformer: An implementation of Fastformer:... 26
An implementation of Fastformer: Additive Attention Can Be All You Need in TensorFlow - GitHub - Rishit-dagli/Fast-Transformer: An implementation of Fastformer: Additive Attention Can Be All You Ne... | Nice work!
If you have the trained model, maybe you could also publish it on Tensorflow Hub 3 | 0 |
tensorflow | Show and Tell | Trying to get TFJS better supported at Edge Impulse | https://discuss.tensorflow.org/t/trying-to-get-tfjs-better-supported-at-edge-impulse/3507 | Edgeimpulse.com 2 tinyML Machine Learning supports exports to Tensorflow, TensorflowLite, TensorflowMicro but not TensorflowJs. It can easily be converted from one of the other formats but typically takes a python script which is not Javascript.
Perhaps a few people could “like” the following Feature Request at EdgeImpulse.com 1 to increase its chances of adoption.
Edge Impulse – 5 Aug 21
Feature Request: export TensorflowJS 3
Could Edge Impulse please fully support all versions of Tensorflow specifically by adding dashboard exported support for TensorflowJs? Would show a zipped model.json with binary shard files, preferably float32 and also with int8 quantization. ... | So it looks like Edge Impulse will not be helping with exporting to TFJS.
Anyone any opinions on how to convert from Tensorflow saved model to TensorflowJs layers model. I used to do it all the time but my code doesn’t seem to work anymore. Anyone got uptodate conversion examples and installation code.
I used to have several steps full automated on this github to take a model.json to several other forms, but I dont even thing the instalation is working anymore.
Any suggestions?
github.com
GitHub - hpssjellis/Gitpod-auto-tensorflowJS-to-arduino 1
Contribute to hpssjellis/Gitpod-auto-tensorflowJS-to-arduino development by creating an account on GitHub.
‘’’
pip install tf-nightly
pip install tensorflowjs
pip install netron “dask[delayed]”
tensorflowjs_converter --input_format=tfjs_layers_model --output_format=keras_saved_model ./model.json ./
tflite_convert --keras_model_file ./ --output_file ./model.tflite
xxd -i model.tflite model.h
‘’’ | 0 |
tensorflow | Show and Tell | Learning multimodal entailment | https://discuss.tensorflow.org/t/learning-multimodal-entailment/3696 | Sentence 1: Sourav Ganguly is the greatest captain in BCCI.
Sentence 2: Ricky Ponting is the greatest captain in Cricket Australia.
Do these two sentences contradict/entail each other or are they neutral? In NLP, this problem is known as textual entailment and is a part of the GLUE benchmark for language understanding.
On social media platforms, to better curate and moderate content, we often need to utilize multiple sources of data to understand their semantic behavior. This is where multimodal entailment can be useful. In my latest post, I introduce the basics of this topic and present a set of baseline models for the Multimodal Entailment dataset recently introduced by Google. Some recipes include “modality dropout”, cross-attention, and class-imbalance mitigation.
Blog post: Multimodal entailment 4
Code: https://git.io/JR0HU 4
Fun fact: This marks the 100th example on keras.io 1. | Thanking @markdaoust, @lgusm, and @jbgordon for the amazing tutorial on
TensorFlow
Solve GLUE tasks using BERT on TPU | Text | TensorFlow 2
My post on multimodal entailment uses a fair bit of code from that post (of course with due citation). With that, I wanted to take the opportunity to thank you, folks, for the tutorial since it DEFINITELY helps in solving GLUE tasks more accessible and readily approachable. | 0 |
tensorflow | Show and Tell | Minimal implementation of NeRF | https://discuss.tensorflow.org/t/minimal-implementation-of-nerf/3663 | Our new Keras example just got published in Keras.
Link: 3D volumetric rendering with NeRF 23
In this joint venture with Ritwik Raha 5, we present a minimal implementation of the research paper NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis by Ben Mildenhall et. al. The authors have proposed an ingenious way to synthesize novel views of a scene by modelling the volumetric scene function through a neural network. We try making concepts like 3D volumetric rendering and ray tracing as visual as possible.
We would like to thank @Sayak_Paul for his thorough review of the first draft. We also want to acknowledge @fchollet for his guidance through and through.
The GIFs in the example are made with manim 5. We like how the animations have turned out to be.
manim854×480 2.05 MB | This looks very interesting.
Sorry for my ignorance but after you train the model, can you apply to new data easily? | 0 |
tensorflow | Show and Tell | Involution: Inverting the Inherence of Convolution for Visual Recognition | https://discuss.tensorflow.org/t/involution-inverting-the-inherence-of-convolution-for-visual-recognition/1568 | Where convolutions have been the doing great at what it does, involution symmetrically inverts the inherent properties of convolutions. Where convs are spatial-agnostic and channel-specific operations, invs are spatial-specific and channel-agnostic operations.
My take on Involutions: GitHub - ariG23498/involution-tf: TensorFlow implementation of involution. 15
Here one can find the Involution Layer which has all the necessary code to build the kernel dynamically and also apply it on the input feature space. One can also pick the code up and apply the layer to any tf based architecture. | Hey Folks,
I have also had the opportunity to write on this topics as a Keras example.
Link: Involutional neural networks 4
Any feedback is welcome. | 0 |
tensorflow | Show and Tell | Knowledge distillation with “Function Matching” | https://discuss.tensorflow.org/t/knowledge-distillation-with-function-matching/3306 | Hi folks,
Today I am pleased to open-source the code for implementing the recipes from Knowledge distillation: A good teacher is patient and consistent 11 (function matching) and reproducing their results on three benchmark datasets: Pet37, Flowers102, and Food101.
Importance: The importance of knowledge distillation lies in its practical usefulness. With the recipes from “function matching”, we can now perform knowledge distillation using a principled approach yielding student models that can actually match the performance of their teacher models. This essentially allows us to compress bigger models into (much) smaller ones thereby reducing storage costs and improving inference speed.
Some features of the repository I wanted to highlight:
The code is provided as Kaggle Kernel Notebooks to allow the usage of free TPU v3-8 hardware. This is important because the training schedules are comparatively longer.
There’s a notebook 1 on distributed hyperparameter tuning and it’s often not included in the public release of an implementation.
For reproducibility and convenience, I have provided pre-trained models and TFRecords for all the datasets I used.
Here’s a link to the repository
github.com
GitHub - sayakpaul/FunMatch-Distillation: TF2 implementation of knowledge... 10
TF2 implementation of knowledge distillation using the "function matching" hypothesis from https://arxiv.org/abs/2106.05237. - GitHub - sayakpaul/FunMatch-Distillation: TF2 implementation...
I’d like to sincerely thank Lucas Beyer (first author of the paper) for providing crucial feedback on the earlier implementations, ML-GDE program for the GCP support, and TRC for providing TPU access. For any questions, either create an issue in the repository directly or email me.
Thank you for reading! | Very exciting Sayak, thanks! | 0 |
tensorflow | Show and Tell | Vector-Quantized Variational Autoencoders | https://discuss.tensorflow.org/t/vector-quantized-variational-autoencoders/3247 | Vector-Quantized VAEs were proposed in 2017. Since its inception, it has pushed the field of high-quality image generation to a great extent. Its recipes like discrete latent space optimization, codebook sampling, etc. have gone to later become essential blocks for modern models like VQ-GAN, DALL-E, etc.
In my latest Keras example, I present an implementation VQ-VAEs including the subsequent PixelCNN part for image reconstruction and generation. I’ve included crucial pieces of visualizations as well to make it fun and interesting.
image2916×1574 411 KB
Here is the link to my example:
keras.io
Keras documentation: Vector-Quantized Variational Autoencoders 12 | Well done Sayak!
always great content! | 0 |
tensorflow | Show and Tell | Clarifications on parsing arguments in a TFX pipeline | https://discuss.tensorflow.org/t/clarifications-on-parsing-arguments-in-a-tfx-pipeline/3195 | I have been building my muscle memory for MLOps and the progress has been good so far. Thanks to Coursera’s Specialization, ML Design Patterns book, and Vertex AI’s neat examples.
I wanted to build a simple Vertex AI pipeline that should train a custom model and deploy it. TFX pipelines seemed like a way easier choice for this than KFP pipelines.
I am now referring to this stock example:
colab.research.google.com
Google Colaboratory 3
I see loads of argument parsing here and there, especially in the model building utilities. For reference, here’s a snippet that creates ExampleGen and Trainer in the initial TFX pipeline:
# Brings data into the pipeline.
example_gen = tfx.components.CsvExampleGen(input_base=data_root)
# Uses user-provided Python function that trains a model.
trainer = tfx.components.Trainer(
module_file=module_file,
examples=example_gen.outputs['examples'],
train_args=tfx.proto.TrainArgs(num_steps=100),
eval_args=tfx.proto.EvalArgs(num_steps=5))
The run_fn only takes fn_args as its arguments. I am wondering how the arguments passed and mapped inside penguin_trainer.py?
I will be grateful for an elaborate answer. | I guess @Robert_Crowe might be able to help here | 0 |
tensorflow | Show and Tell | Compact Convolutional Transformers | https://discuss.tensorflow.org/t/compact-convolutional-transformers/2686 | How does a commoner train a Transformers-based model on small and medium datasets like CIFAR-10, ImageNet-1k and still attain competition results? What if they don’t have the luxury of using a modern GPU cluster or TPUs?
You use Compact Convolutional Transformers (CCT). In this example, I walk you through the concept of CCTs and also present their implementation in Keras demonstrating their performance on CIFAR-10:
keras.io
Keras documentation: Compact Convolutional Transformers 45
A traditional ViT model would take about 4 Million parameters to get to 78% on CIFAR-10 with 100 epochs. CCTs would take 30 epoch and 0.4 Million parameters to get there | Well done Sayak!!! you’re on fire!! | 0 |
tensorflow | Show and Tell | Best optmization algorithm | https://discuss.tensorflow.org/t/best-optmization-algorithm/2486 | Hello Community
I have just developed an algorithm (I can say a family of algorithms) which have as performance a fast convergence while maintaining the generalization
I ask you for any help and advice
I want to join a company as a researcher in the field of artificial intelligence. having access to very expensive hardware (like GPUs) and more…
Here are the results of one of my algorithms in MNIST and IMBD data.( conduct on personal computer)
sincerely | Hi there,
This seems interesting. I do observe, however, that certainly for a low number of epochs, your algorithm has lower accuracy compared to the industry standards. Perhaps your approach has some other benefits that are not represented on these graphs? (time wise?)
Cheers,
Timo | 0 |
tensorflow | Show and Tell | FX toy project (BERT as a service) | https://discuss.tensorflow.org/t/fx-toy-project-bert-as-a-service/2392 | Hey everyone, I would like to share with you all a small project 18 that I had worked at my spare time, I called it “BERT as a service”, the goal is to build an end-to-end TFX pipeline for sentiment analysis using BERT. This project 18 is educational and is also aimed to provide a simple and easier reference for people that are looking to get familiar with MLOps using TFX and GCP (as was my case), but should not be that hard to tweak it to be more “production-ready”.
Here is an overview of what you will find:
An end-to-end ML pipeline, from data ingestion, data validation, transformation, training, and deployment.
Usage of specific components for infrastructure validation and hyperparameter tuning.
Orchestration using KubeFlow and the new Vertex AI
New version of TFX (1.0.0)
Colab version has a Tunner component that uses KerasTunner for HP search.
KubeFlow version has Infravalidator component to validate infra before blessing the model for deployment.
This was a very cool experience to get more familiar with MLOps concepts applied to the GCP ecosystem, if you have a similar project or any feedback I would love to know more. | This looks cool @DimitreOliveira !
@Robert_Crowe might have some insights on your project! | 0 |
tensorflow | Show and Tell | New Keras Example, Gradient Centralization for Better Training Performance | https://discuss.tensorflow.org/t/new-keras-example-gradient-centralization-for-better-training-performance/2158 | This new code walkthrough by me on Keras.io 4 talks about gradient centralization, a simple trick that can markedly speed up model convergence which is implemented in Keras in literally 10 lines of code. This can both speed up the training process and improve the final generalization performance of DNNs.
Further, this code example also shows the improvements on using Gradient Centralization while training on @Laurence_Moroney 's Horses v Humans dataset.
keras.io
Keras documentation: Gradient Centralization for Better Training Performance 18
This was also my first time contributing to Keras examples and many thanks to @fchollet and @Sayak_Paul for helping all along! | Interesting! That worked really well in the example.
I’m not quite getting the intuition for what this does/why it works. What’s your understanding? I think I understand why you keep the last axis, and what this would do with SGD. But it’s less clear when applied through one of these more complex optimizers. Can you summarize your understanding of it (without using the word “Lipschitzness” ). | 0 |
tensorflow | Show and Tell | Video Classification with a CNN-RNN Architecture | https://discuss.tensorflow.org/t/video-classification-with-a-cnn-rnn-architecture/1729 | How do we process videos to feed to a Deep Learning model and train it? Can we borrow concepts from image and text models and combine those to train a video classification model? Yes, we can.
My latest example on keras.io 6 shows you how:
keras.io
Keras documentation: Video Classification with a CNN-RNN Architecture 65 | Nice work Sayak!! Added to my to-read list!! | 0 |
tensorflow | Show and Tell | Streamline your ML training workflow with Vertex AI | https://discuss.tensorflow.org/t/streamline-your-ml-training-workflow-with-vertex-ai/1661 | Karl Weinmeister 3 and I co-authored this blog post that discusses important concepts in Vertex AI [1]. It also shows you how to run a simple TensorFlow training job using Vertex AI.
Google Cloud Blog
Streamline your ML training workflow with Vertex AI | Google Cloud Blog 20
Many of us have used a local computing environment for machine learning (ML). For some problems, a local environment is more than enough. Plus, there's a lot of flexibility. Install Python, install JupyterLab, and go!
It’s really nice to see how well TensorFlow integrates with Google Cloud. First, there’s AI Platform. Second, there’s Vertex AI that provides simpler APIs with more flexibility. Third, there’s TensorFlow Cloud. It’s even nicer that TFX can fit into most of these workflows.
[1] Vertex AI | Google Cloud 2 | Great post Sayak!
There’s also this great one about using #TFHub models with Vertex AI for inference:
Google Cloud Blog
Serve a TensorFlow Hub model in Google Cloud with Vertex AI | Google Cloud Blog 6
Make open-source TensorFlow Hub models ready for production by hosting them with Google Cloud's Vertex AI.
I’m very happy on how easy it is to create a rest API.
What do you think? | 0 |
tensorflow | Show and Tell | Using the FaceNet model for face recognition in Android | https://discuss.tensorflow.org/t/using-the-facenet-model-for-face-recognition-in-android/1409 | The FaceNet model has been widely adopted by the ML community for face recognition tasks. A number of Python packages are available by which can be used to leverage the powers of FaceNet.
We have used the FaceNet model to produce 128D embeddings for each face, captured in the live camera feed, so as perform face recognition in an Android app. This recognition follows the traditional approach of computing the Euclidean distance between the embeddings ( or by computing the cosine of the angle between them ).
The “Keras” of FaceNet is first converted to a TensorFlow Lite model ( Using TFLiteConverter API ) which is then used in the Android app. To perform face detection, we use Firebase MLKit’s FaceDetector. Here’s the GitHub project,
github.com
shubham0204/FaceRecognition_With_FaceNet_Android 294
Face Recognition using FaceNet and Firebase MLKit on Android. | Awesome! Thank you for taking the time to share this useful information.
I am learning how to set up and coordinate I.o.T. sensors and switches for controlling humidity, air exchange, and lighting in my fruiting chamber for gourmet mushrooms.
I intend to make this network of sensors and controllers secure so FaceNet would be perfect to use for faster access when I connect from outside the LAN.
I will definitely do more research about the FaceNet model. Thanks for the link! | 0 |
tensorflow | Show and Tell | Drawing with Dice via AI | https://discuss.tensorflow.org/t/drawing-with-dice-via-ai/1209 | I made a basic model in TensorFlow.js to show me how to make dice art.
I’ve been able to make basic logos out of dice! If anyone is interested in making a more advanced model with the data, I’d love to collaborate.
Until then, check this out!
1_P0rAzGyIzUzR2YVykCnpcw4000×3000 2.23 MB
Here’s the blog post, clap if you like it!
Medium – 19 May 21
[From our friends] Dicify AI 6
Making art from science using AI in TensorFlow.js
Reading time: 7 min read | Oh yeah! I forgot to mention, it’s hanging up on @Jason 's wall!
1_a_Ev0uMVMlId51Liv6TzPA1280×718 164 KB
I loved this project. I do think it could be even better! I have lots of JavaScript code for the project, and it’s the capstone of my book. | 0 |
tensorflow | Show and Tell | Spatial Transformer Networks with Keras | https://discuss.tensorflow.org/t/spatial-transformer-networks-with-keras/285 | Spatial Transformer Networks (STN) have been there since 2015 but I haven’t found an easy-to-follow example of it for #Keras.
On the other hand, Kevin Zakka’s implementation of STN 28 is by far one of the cleanest ones but it’s purely in TensorFlow 1. So, I decided to take the utility functions from his implementation and prepare an end-to-end example in #Keras out of it. You can find it here:
github.com
sayakpaul/Spatial-Transformer-Networks-with-Keras 55
This repository provides a Colab Notebook that shows how to use Spatial Transformer Networks inside CNNs build in Keras.
Comes with a Colab Notebook and also a TensorBoard callback that helps visualize the progressions of the transformations learned by STN during training.
Notice how the STN module is able to figure out transformations for the dataset that may be helpful to boost its performance -
https://user-images.githubusercontent.com/22957388/115120399-e8084b80-9fca-11eb-97e1-c72228c3edc4.mov | Thanks, Sayuk! More concrete examples of how to combine the myriad techniques and tools helps the folks who come after you.
re: the tensorboard line in the notebook. Have you played with tensorboard.dev? If you changed that line then anyone could upload to a public hosted TensorBoard and they could share links to their specific runs. here’s a deep link to a demo colab showing how to upload to tensorboard.dev directly 1 if you’re interested. | 0 |
tensorflow | Show and Tell | A thread for collecting outstanding (unofficial) tutorials from around the web | https://discuss.tensorflow.org/t/a-thread-for-collecting-outstanding-unofficial-tutorials-from-around-the-web/128 | This is a thread to collect and recognize outstanding (unofficial) TensorFlow tutorials (or blog posts that are mainly about specific usage of TensorFlow) from around the web.
I’ll start with a seed. I found Effective TensorFlow 2 14 to be a solid and concise tutorial. It has a nice flow and covers interesting gotchas and pitfalls. | I’d like to add this Tutorial from keras.io 3: Natural language image search with a Dual Encoder 8
it implements a model inspired by CLIP 5 using TensorFlow and TFHub. I | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.