{"id":69,"date":"2026-04-10T12:19:38","date_gmt":"2026-04-10T12:19:38","guid":{"rendered":"https:\/\/gigz.pk\/dl\/?post_type=lesson&#038;p=69"},"modified":"2026-04-10T18:11:50","modified_gmt":"2026-04-10T18:11:50","slug":"using-pretrained-models","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/","title":{"rendered":"\u00a0Using Pretrained Models"},"content":{"rendered":"\n<p>Pretrained models are deep learning models that have already been trained on large datasets. Instead of building a model from scratch, we can use these existing models and adapt them to our own tasks. This approach is widely used in transfer learning and is very effective for saving time and improving accuracy.<\/p>\n\n\n\n<p><strong>What are Pretrained Models?<\/strong><br>Pretrained models are neural networks trained on large-scale datasets such as ImageNet. They have already learned useful features like edges, shapes, textures, and patterns. These learned features can be reused for new tasks.<\/p>\n\n\n\n<p><strong>Why Use Pretrained Models?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Save training time and computing resources<\/li>\n\n\n\n<li>Improve accuracy with less data<\/li>\n\n\n\n<li>Reduce risk of overfitting<\/li>\n\n\n\n<li>Work well for complex deep learning tasks<\/li>\n\n\n\n<li>Provide strong baseline performance<\/li>\n<\/ul>\n\n\n\n<p><strong>How Pretrained Models Work<\/strong><\/p>\n\n\n\n<p><strong>1. Feature Extraction<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the pretrained model as a fixed feature extractor<\/li>\n\n\n\n<li>Early layers are kept frozen<\/li>\n\n\n\n<li>Only new layers are trained<\/li>\n<\/ul>\n\n\n\n<p><strong>2. Fine-Tuning<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Unfreeze some layers of the pretrained model<\/li>\n\n\n\n<li>Train the model on new dataset<\/li>\n\n\n\n<li>Helps adapt to specific tasks<\/li>\n<\/ul>\n\n\n\n<p><strong>Popular Pretrained Models<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>VGG16<\/li>\n\n\n\n<li>ResNet50<\/li>\n\n\n\n<li>InceptionV3<\/li>\n\n\n\n<li>MobileNet<\/li>\n\n\n\n<li>EfficientNet<\/li>\n<\/ul>\n\n\n\n<p><strong>Steps to Use Pretrained Models<\/strong><\/p>\n\n\n\n<p><strong>Step 1: Load Pretrained Model<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Import model with pretrained weights<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Freeze Base Layers<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Prevent updating original learned features<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: Add Custom Layers<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add new layers for your specific problem<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 4: Compile Model<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Choose optimizer, loss function, and metrics<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 5: Train Model<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Train only new layers or fine-tune selected layers<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 6: Evaluate Model<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Test performance on validation data<\/li>\n<\/ul>\n\n\n\n<p><strong>Example: Using Pretrained Model in Python (Keras)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">from tensorflow.keras.applications import ResNet50<br>from tensorflow.keras.models import Sequential<br>from tensorflow.keras.layers import Dense, Flatten# Load pretrained model<br>base_model = ResNet50(weights='imagenet', include_top=False, input_shape=(224, 224, 3))# Freeze base model layers<br>for layer in base_model.layers:<br>    layer.trainable = False# Build custom model<br>model = Sequential([<br>    base_model,<br>    Flatten(),<br>    Dense(128, activation='relu'),<br>    Dense(2, activation='softmax')<br>])model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])model.summary()<\/pre>\n\n\n\n<p><strong>Advantages of Pretrained Models<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Faster development process<\/li>\n\n\n\n<li>High accuracy with small datasets<\/li>\n\n\n\n<li>Reduced computational cost<\/li>\n\n\n\n<li>Strong feature extraction capabilities<\/li>\n<\/ul>\n\n\n\n<p><strong>Limitations<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>May not perfectly fit all custom tasks<\/li>\n\n\n\n<li>Requires careful fine-tuning<\/li>\n\n\n\n<li>Large model size may need high memory<\/li>\n<\/ul>\n\n\n\n<p><strong>Applications<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Image classification systems<\/li>\n\n\n\n<li>Object detection models<\/li>\n\n\n\n<li>Medical imaging analysis<\/li>\n\n\n\n<li>Face recognition systems<\/li>\n\n\n\n<li>Natural language processing tasks<\/li>\n<\/ul>\n\n\n\n<p><strong>Lesson Summary<\/strong><br>Using pretrained models allows developers to leverage existing knowledge from large datasets. This makes deep learning faster, more efficient, and more accurate, especially when working with limited data or complex tasks.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/dl\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">Deep Learning Intermediate > Computer Vision Projects > Using Pretrained Models<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1775823532935\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n","protected":false},"menu_order":44,"template":"","class_list":["post-69","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u00a0Using Pretrained Models - Deep Learning Mastery<\/title>\n<meta name=\"description\" content=\"Learn using pretrained models in deep learning. Improve accuracy, save time, and build AI projects with transfer learning.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u00a0Using Pretrained Models - Deep Learning Mastery\" \/>\n<meta property=\"og:description\" content=\"Learn using pretrained models in deep learning. Improve accuracy, save time, and build AI projects with transfer learning.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/\" \/>\n<meta property=\"og:site_name\" content=\"Deep Learning Mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-10T18:11:50+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/index.php\\\/lesson\\\/using-pretrained-models\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/index.php\\\/lesson\\\/using-pretrained-models\\\/\",\"name\":\"\u00a0Using Pretrained Models - Deep Learning Mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/#website\"},\"datePublished\":\"2026-04-10T12:19:38+00:00\",\"dateModified\":\"2026-04-10T18:11:50+00:00\",\"description\":\"Learn using pretrained models in deep learning. Improve accuracy, save time, and build AI projects with transfer learning.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/index.php\\\/lesson\\\/using-pretrained-models\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/dl\\\/index.php\\\/lesson\\\/using-pretrained-models\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/index.php\\\/lesson\\\/using-pretrained-models\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deep Learning Intermediate > Computer Vision Projects > Using Pretrained Models\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/\",\"name\":\"Deep Learning Mastery\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/dl\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00a0Using Pretrained Models - Deep Learning Mastery","description":"Learn using pretrained models in deep learning. Improve accuracy, save time, and build AI projects with transfer learning.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/","og_locale":"en_US","og_type":"article","og_title":"\u00a0Using Pretrained Models - Deep Learning Mastery","og_description":"Learn using pretrained models in deep learning. Improve accuracy, save time, and build AI projects with transfer learning.","og_url":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/","og_site_name":"Deep Learning Mastery","article_modified_time":"2026-04-10T18:11:50+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/","url":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/","name":"\u00a0Using Pretrained Models - Deep Learning Mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/dl\/#website"},"datePublished":"2026-04-10T12:19:38+00:00","dateModified":"2026-04-10T18:11:50+00:00","description":"Learn using pretrained models in deep learning. Improve accuracy, save time, and build AI projects with transfer learning.","breadcrumb":{"@id":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/dl\/index.php\/lesson\/using-pretrained-models\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/dl\/"},{"@type":"ListItem","position":2,"name":"Deep Learning Intermediate > Computer Vision Projects > Using Pretrained Models"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/dl\/#website","url":"https:\/\/gigz.pk\/dl\/","name":"Deep Learning Mastery","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/dl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/dl\/index.php\/wp-json\/wp\/v2\/lesson\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/dl\/index.php\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/dl\/index.php\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/dl\/index.php\/wp-json\/wp\/v2\/media?parent=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}