Code Monkey home page Code Monkey logo

curiousily / deep-learning-for-hackers Goto Github PK

View Code? Open in Web Editor NEW
991.0 991.0 434.0 22.72 MB

Machine Learning tutorials with TensorFlow 2 and Keras in Python (Jupyter notebooks included) - (LSTMs, Hyperameter tuning, Data preprocessing, Bias-variance tradeoff, Anomaly Detection, Autoencoders, Time Series Forecasting, Object Detection, Sentiment Analysis, Intent Recognition with BERT)

Home Page: https://www.mlexpert.io/

License: MIT License

Jupyter Notebook 100.00%
anomaly-detection artificial-intelligence autoencoders bert deep-learning image-augmentation intent-recognition jupyter-notebooks keras lstms machine-learning neural-networks object-detection python sentiment-analysis tensorflow tensorflow-tutorial time-series-classification time-series-forecasting

deep-learning-for-hackers's Introduction

Hacker's Guide to Machine Learning with Python ๐Ÿฑโ€๐Ÿ’ป

This book brings the fundamentals of Machine Learning to you, using tools and techniques used to solve real-world problems in Computer Vision, Natural Language Processing, and Time Series analysis. The skills taught in this book will lay the foundation for you to advance your journey to Machine Learning Mastery.

Open In Colab

Read the book here

๐Ÿ“– Read for FREE

The whole book can be read using the links below. Each part contains a notebook that you can find in this repository.

Consider buying the book if you want to support my work. Thanks for stopping by! ๐Ÿค—

deep-learning-for-hackers's People

Contributors

curiousily avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deep-learning-for-hackers's Issues

Questions regarding Intent Recognition with BERT using Keras and TensorFlow 2

Thanks for sharing your work. That is really helpful. However in the tutorial "Intent Recognition with BERT using Keras and TensorFlow 2", why the valid loss/acc do not change by epoches? The training loss/acc are improved but the model seems to have good performance on the valid dataset before any finetuning.

Step meaning

Hi, sorry for a basic question, i think, but, i see no material or explanation of the 'step' variable. Just trying to edit for my code but unsure exactly. I understand time_step = how many steps does my time series inputs. But steps?

Thanks,
Tom

Issue while training the model

Hi. I am using your google colab to test object detection on my own dataset which I have uploaded on your google colab folder. Everything runs fine before the training step i.e. before "Downloaded pretrained model to ./snapshots/_pretrained_model.h5" step.

But when I am running the command "!keras_retinanet/bin/train.py --freeze-backbone --random-transform --weights {PRETRAINED_MODEL} --batch-size 8 --steps 500 --epochs 10 csv annotations.csv classes.csv" on the colab, the model is running only for one epoch and only one file "resnet50_csv_01.h5" is getting generated and the iterations is not running after 1st epoch.

Even I tried the same in my local machine and the same issue is happening i.e. after 1st epoch the process is stopping even though number of epochs in the command is 10. In my local machine and even in the google colab I have seen that tensorflow version is 2.4.

Can you let me know what is the issue.

object detection

I want to ask for your advice. I want to identify the bottles in the trash can. The real image is about this:

20200611112928_B_Q

20200611112934_B_Q

20200611113139_B_Q

49

The most complex part of this scene is the dense shielding and stacking of bottles. Our purpose is to tell the customer who threw the bottle what kind of bottle he threw in, and it's better to return the location information of the bottle at the bottom of the trash can. At present, I use Yolo series for testing, and the effect is always unsatisfactory.

I want to know does you have any suggestions to improve the detection and classification ability in this scenario?

Much obliged for your assistance.

how to convert .h5 to .pb

how can i convert .h5 file to .pb,
i want to use trained model in java application,

Any advise or guidance would be greatly appreciated..!!
Thanks

Exception when converting to TFLiteModel

I was using the file "13.time-series-human_activity_recognition.ipynb"

And trying to convert the model to TfLite so that i can use it in Android Project am getting an exception.

Using Below code.

converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()

# Save the model.
with open('model.tflite', 'wb') as f:
  f.write(tflite_model)

If you can suggest what could be the issue.

Observe the same issue for

model.save("./")

converter = tf.lite.TFLiteConverter.from_saved_model("./")
tflite_model = converter.convert()

converter.convert() is the line which throws

when run train it gives an error

!keras_retinanet/bin/train.py --freeze-backbone --random-transform --weights {PRETRAINED_MODEL} --batch-size 8 --steps 500 --epochs 10 csv annotations.csv classes.csv

Traceback (most recent call last):
File "keras_retinanet/bin/train.py", line 540, in
main()
File "keras_retinanet/bin/train.py", line 500, in main
config=args.config
File "keras_retinanet/bin/train.py", line 114, in create_models
model = model_with_weights(backbone_retinanet(num_classes, num_anchors=num_anchors, modifier=modifier), weights=weights, skip_mismatch=True)
File "keras_retinanet/bin/../../keras_retinanet/models/resnet.py", line 38, in retinanet
return resnet_retinanet(*args, backbone=self.backbone, **kwargs)
File "keras_retinanet/bin/../../keras_retinanet/models/resnet.py", line 99, in resnet_retinanet
resnet = keras_resnet.models.ResNet50(inputs, include_top=False, freeze_bn=True)
File "/usr/local/lib/python3.6/dist-packages/keras_resnet/models/_2d.py", line 188, in ResNet50
return ResNet(inputs, blocks, numerical_names=numerical_names, block=keras_resnet.blocks.bottleneck_2d, include_top=include_top, classes=classes, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras_resnet/models/_2d.py", line 66, in ResNet
x = keras_resnet.layers.BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name="bn_conv1")(x)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 922, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 265, in wrapper
raise e.ag_error_metadata.to_exception(e)
TypeError: in user code:

/usr/local/lib/python3.6/dist-packages/keras_resnet/layers/_batch_normalization.py:17 call  *
    return super(BatchNormalization, self).call(training=(not self.freeze), *args, **kwargs)

TypeError: type object got multiple values for keyword argument 'training'

Error when running 03. stock notebook

I am getting
NotImplementedError: Cannot convert a symbolic Tensor (bidirectional/forward_cu_dnnlstm/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

for
model.add(Bidirectional(CuDNNLSTM(WINDOW_SIZE, return_sequences=True),
input_shape=(WINDOW_SIZE, X_train.shape[-1])))

I am running Tensorflow 2.4.0rc0 and numpy 1.21.4

i saw somewhere the moving back to numpy==1.19.5 could resolve it, but it did not have an impact

Can you advise the best direction here?

**model = create_model(data.max_seq_len, bert_ckpt_file)** gives Layer input_spec must be an instance of InputSpec. Got: InputSpec(shape=(None, 38, 768), ndim=3)

model = create_model(data.max_seq_len, bert_ckpt_file) gives error


TypeError Traceback (most recent call last)
in ()
----> 1 model = create_model(data.max_seq_len, bert_ckpt_file)

5 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/autograph/impl/api.py in wrapper(*args, **kwargs)
693 except Exception as e: # pylint:disable=broad-except
694 if hasattr(e, 'ag_error_metadata'):
--> 695 raise e.ag_error_metadata.to_exception(e)
696 else:
697 raise

TypeError: in user code:

/usr/local/lib/python3.7/dist-packages/bert/model.py:80 call  *
    output           = self.encoders_layer(embedding_output, mask=mask, training=training)
/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py:1030 __call__  **
    self._maybe_build(inputs)
/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py:2659 _maybe_build
    self.build(input_shapes)  # pylint:disable=not-callable
/usr/local/lib/python3.7/dist-packages/bert/transformer.py:209 build
    self.input_spec = keras.layers.InputSpec(shape=input_shape)
/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py:2777 __setattr__
    super(tf.__internal__.tracking.AutoTrackable, self).__setattr__(name, value)  # pylint: disable=bad-super-call
/usr/local/lib/python3.7/dist-packages/tensorflow/python/training/tracking/base.py:530 _method_wrapper
    result = method(self, *args, **kwargs)
/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py:1297 input_spec
    'Got: {}'.format(v))

TypeError: Layer input_spec must be an instance of InputSpec. Got: InputSpec(shape=(None, 38, 768), ndim=3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.