Close Menu
    Trending
    • Why I Still Don’t Believe in AI. Like many here, I’m a programmer. I… | by Ivan Roganov | Aug, 2025
    • The Exact Salaries Palantir Pays AI Researchers, Engineers
    • “I think of analysts as data wizards who help their product teams solve problems”
    • These 5 Programming Languages Are Quietly Taking Over in 2025 | by Aashish Kumar | The Pythonworld | Aug, 2025
    • Chess grandmaster Magnus Carlsen wins at Esports World Cup
    • How I Built a $20 Million Company While Still in College
    • How Computers “See” Molecules | Towards Data Science
    • Darwin Godel Machine | Nicholas Poon
    AIBS News
    • Home
    • Artificial Intelligence
    • Machine Learning
    • AI Technology
    • Data Science
    • More
      • Technology
      • Business
    AIBS News
    Home»Machine Learning»A Technical Introduction to Keras and TensorFlow in Machine Learning | by Emirhan Ülker | Jul, 2025
    Machine Learning

    A Technical Introduction to Keras and TensorFlow in Machine Learning | by Emirhan Ülker | Jul, 2025

    Team_AIBS NewsBy Team_AIBS NewsJuly 29, 2025No Comments3 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    TensorFlow is an open-source deep studying framework developed by Google Mind. Launched in 2015, it has develop into broadly utilized in each educational analysis and industrial initiatives.

    • Low-level management: Tensor operations, automated differentiation, customized layer definition
    • Distributed coaching: Multi-GPU and TPU assist
    • Graph-based computation: Static graphs in TF 1.x, keen execution in TF 2.x
    • Wealthy ecosystem: TFX, TensorFlow Lite, TensorFlow Serving
    Zoom picture shall be displayed

    The TensorFlow Model Analysis (TFMA) pipeline

    Keras was initially developed as a standalone high-level API; right now, it’s totally built-in with TensorFlow 2.x as tf.keras Its simplicity and concise code construction make it ideally suited for speedy prototyping.

    • Easy API: Helps Sequential and Practical API
    • Mannequin abstraction: Straightforward definition of layers, optimizers, and loss features
    • Backend integration: Runs on high of TensorFlow
    Zoom picture shall be displayed

    TensorFlow gives the low-level computation engine, whereas Keras serves because the user-friendly API layer constructed on high of it.

    • Keras = Abstraction layer / Straightforward to make use of
    • TensorFlow Core = Low-level management / Flexibility
    Zoom picture shall be displayed

    Keras provides the API layer, TensorFlow handles computation.

    Use Keras (Speedy Prototyping)

    • Shortly construct and take a look at fashions
    • Excellent for Kaggle competitions
    • Nice for baseline fashions

    Use TensorFlow Core (Low-Degree Management)

    • Customized loss features and layers
    • Efficiency optimization
    • {Hardware}-level configurations

    The next instance demonstrates a easy classifier utilizing Keras API with TensorFlow backend:

    import tensorflow as tf
    from tensorflow.keras import layers, fashions

    # Load dataset
    (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
    x_train, x_test = x_train / 255.0, x_test / 255.0

    # Outline mannequin
    mannequin = fashions.Sequential([
    layers.Flatten(input_shape=(28, 28)),
    layers.Dense(128, activation='relu'),
    layers.Dropout(0.2),
    layers.Dense(10, activation='softmax')
    ])

    # Compile
    mannequin.compile(optimizer='adam',
    loss='sparse_categorical_crossentropy',
    metrics=['accuracy'])

    # Prepare
    mannequin.match(x_train, y_train, epochs=5)

    # Consider
    mannequin.consider(x_test, y_test)

    from tensorflow.keras.preprocessing.picture import ImageDataGenerator
    import tensorflow as tf

    BATCH_SIZE = 16

    print("nLoading coaching knowledge...")

    training_data_generator = ImageDataGenerator(
    rescale=1./255,
    zoom_range=0.2,
    rotation_range=15,
    width_shift_range=0.05,
    height_shift_range=0.05)

    training_iterator = training_data_generator.flow_from_directory('/Customers/emirhanulker/Paperwork/PneumoniaDetectionUsingCNN/chest_xray/take a look at',class_mode='categorical',color_mode='grayscale',batch_size=BATCH_SIZE)

    print("nLoading validation knowledge...")

    validation_data_generator = ImageDataGenerator(
    rescale=1./255
    )

    validation_iterator = validation_data_generator.flow_from_directory('/Customers/emirhanulker/Paperwork/PneumoniaDetectionUsingCNN/chest_xray/take a look at',class_mode='categorical', color_mode='grayscale',batch_size=BATCH_SIZE)

    print("nBuilding mannequin...")

    mannequin = tf.keras.Sequential()
    mannequin.add(tf.keras.Enter(form=(256, 256, 1)))
    mannequin.add(tf.keras.layers.Conv2D(2, 5, strides=3, activation="relu"))
    mannequin.add(tf.keras.layers.MaxPooling2D(
    pool_size=(5, 5), strides=(5,5)))
    mannequin.add(tf.keras.layers.Conv2D(4, 3, strides=1, activation="relu"))
    mannequin.add(tf.keras.layers.MaxPooling2D(
    pool_size=(2,2), strides=(2,2)))
    mannequin.add(tf.keras.layers.Flatten())

    mannequin.add(tf.keras.layers.Dense(2,activation="softmax"))

    mannequin.abstract()

    print("nCompiling mannequin...")

    mannequin.compile(
    optimizer=tf.keras.optimizers.Adam(learning_rate=0.005),
    loss=tf.keras.losses.CategoricalCrossentropy(),
    metrics=[tf.keras.metrics.CategoricalAccuracy(),tf.keras.metrics.AUC()]
    )
    print("nTraining mannequin...")

    mannequin.match(
    training_iterator,
    steps_per_epoch=int(training_iterator.samples / BATCH_SIZE),
    epochs=5,
    validation_data=validation_iterator,
    validation_steps=int(validation_iterator.samples / BATCH_SIZE))

    Benefits:

    • Straightforward studying curve
    • Speedy prototyping with minimal code
    • Native integration with TensorFlow 2.x

    Disadvantages:

    • Restricted flexibility for very advanced fashions
    • Requires switching to TensorFlow Core for low-level operations

    Benefits:

    • Excessive flexibility, customized operations potential
    • Distributed coaching assist
    • Appropriate for large-scale initiatives

    Disadvantages:

    • Steeper studying curve
    • Extra boilerplate code required
    1. Handwritten Digit Recognition (MNIST)
    2. Easy Sentiment Evaluation (IMDB Evaluations)
    3. Cat vs. Canine Picture Classification
    4. Pneumonia Detection

    When you’ve mastered the fundamentals of TensorFlow and Keras, listed here are the following steps to advance your deep studying journey:

    1. Work with Extra Advanced Datasets

    • Experiment with CIFAR-10, COCO, or ImageNet
    • Apply switch studying utilizing pre-trained fashions (ResNet, MobileNet)

    2. Be taught Mannequin Deployment

    • Deploy to cellular/internet with TensorFlow Lite or TensorFlow.js
    • Serve fashions through APIs utilizing TensorFlow Serving or Docker

    3. Discover Specialised Deep Studying Fields

    • Pc Imaginative and prescient
    • Pure Language Processing (NLP)
    • Speech and Audio Processing

    4. Be a part of the Group and Construct a Portfolio

    • Take part in Kaggle competitions
    • Contribute to open-source initiatives on GitHub
    • Write articles in Medium about your learnings to share information and showcase abilities

    Recommendation: Begin constructing your personal mission concepts, share them on GitHub, and write about what you be taught. This accelerates your progress and helps create a powerful portfolio for future alternatives.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleLangChain vs LangGraph: Which LLM Framework is Right for You?
    Next Article Skills vs. AI Skills | Towards Data Science
    Team_AIBS News
    • Website

    Related Posts

    Machine Learning

    Why I Still Don’t Believe in AI. Like many here, I’m a programmer. I… | by Ivan Roganov | Aug, 2025

    August 2, 2025
    Machine Learning

    These 5 Programming Languages Are Quietly Taking Over in 2025 | by Aashish Kumar | The Pythonworld | Aug, 2025

    August 2, 2025
    Machine Learning

    Darwin Godel Machine | Nicholas Poon

    August 2, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Why I Still Don’t Believe in AI. Like many here, I’m a programmer. I… | by Ivan Roganov | Aug, 2025

    August 2, 2025

    I Tried Buying a Car Through Amazon: Here Are the Pros, Cons

    December 10, 2024

    Amazon and eBay to pay ‘fair share’ for e-waste recycling

    December 10, 2024

    Artificial Intelligence Concerns & Predictions For 2025

    December 10, 2024

    Barbara Corcoran: Entrepreneurs Must ‘Embrace Change’

    December 10, 2024
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    Most Popular

    Thousands unable to make calls as EE and BT networks down

    July 24, 2025

    Nvidia CEO Says He Would Major in the Physical Sciences

    July 19, 2025

    DeepMind Table Tennis Robots Train Each Other

    July 21, 2025
    Our Picks

    Why I Still Don’t Believe in AI. Like many here, I’m a programmer. I… | by Ivan Roganov | Aug, 2025

    August 2, 2025

    The Exact Salaries Palantir Pays AI Researchers, Engineers

    August 2, 2025

    “I think of analysts as data wizards who help their product teams solve problems”

    August 2, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Business
    • Data Science
    • Machine Learning
    • Technology
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 Aibsnews.comAll Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.