<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Becky Soltanian on Medium]]></title>
        <description><![CDATA[Stories by Becky Soltanian on Medium]]></description>
        <link>https://medium.com/@baharak.soltanian?source=rss-8557ff556d45------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*pgiwG3vlyFhUl2Cz.jpg</url>
            <title>Stories by Becky Soltanian on Medium</title>
            <link>https://medium.com/@baharak.soltanian?source=rss-8557ff556d45------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:52:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@baharak.soltanian/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Enhancing BBC News Classification with TinyBERT and QLoRA]]></title>
            <link>https://medium.com/@baharak.soltanian/enhancing-bbc-news-classification-with-tinybert-and-qlora-e46bbcc0f166?source=rss-8557ff556d45------2</link>
            <guid isPermaLink="false">https://medium.com/p/e46bbcc0f166</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[tinybert]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[qlora]]></category>
            <dc:creator><![CDATA[Becky Soltanian]]></dc:creator>
            <pubDate>Sun, 05 May 2024 00:09:37 GMT</pubDate>
            <atom:updated>2024-05-05T00:17:24.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bFY44HgBUmzBrIp2IKZNrw.jpeg" /></figure><h4>Abstract:</h4><p>In this study, we employ quantization and low-rank adaptation (QLoRA) techniques to optimize a TinyBERT-based model for classifying BBC News articles. Our approach leverages 4-bit quantization and low-rank adaptations to significantly reduce memory footprint while maintaining high classification accuracy.</p><h4>Introduction:</h4><p>The increasing volume of digital news necessitates automated text classification tools. BERT-based models have proven effective in this domain, but their resource requirements often limit their applicability. This paper presents an optimized version using TinyBERT with QLoRA for more efficient classification of BBC News articles.</p><h3>Understanding QLoRA</h3><h4>Introduction to LoRA:</h4><p>LoRA (Low-Rank Adaptation) is a technique designed to reduce the memory and computation requirements of fine-tuning large language models. It does this by freezing most of the model parameters and only training small, low-rank matrices that adapt the model for a specific task. This allows efficient fine-tuning, especially useful when computational resources are limited.</p><h4>Quantized LoRA (QLoRA):</h4><p>QLoRA combines the principles of quantization and LoRA to further reduce the memory and computational demands of large language models. Here’s how it works:</p><ol><li>Quantization: The model’s weights are compressed into lower-bit representations (e.g., 4-bit precision) while maintaining most of the original model’s performance. Quantization reduces the model’s memory footprint, allowing for storage of more models in memory and reducing computational costs.</li><li>Low-Rank Adaptation: A low-rank update matrix is introduced into the quantized model to allow fine-tuning on new data without significantly modifying the original model’s weights. This adaptation introduces minimal overhead compared to fine-tuning the entire model, making the process faster and less memory-intensive.</li></ol><h4>Benefits of QLoRA:</h4><ol><li>Memory Efficiency: By using quantization, QLoRA drastically reduces the amount of memory needed to store and run the model.</li><li>Computation Efficiency: With fewer parameters to update and compute, the training process becomes significantly faster and less resource-intensive.</li><li>Performance: Despite the reductions in memory and computation, QLoRA achieves performance comparable to traditional fine-tuning, making it highly suitable for deployment on resource-constrained devices.</li></ol><h4>Use Cases:</h4><p>QLoRA is particularly useful in scenarios where:</p><ul><li>Models need to be fine-tuned for specific tasks but computational resources are limited.</li><li>Deployment needs to happen on edge devices where memory and computation power are scarce.</li><li>Multiple models need to be run concurrently without consuming large amounts of memory.</li></ul><p>By leveraging QLoRA, models like TinyBERT can be adapted for specific tasks like text classification efficiently, maintaining a balance between performance and resource consumption.</p><h4>Dataset:</h4><p>We used the publicly available BBC News dataset. The dataset consists of articles labeled into categories like business, entertainment, politics, sports, and tech. We preprocess the data using pandas and convert it into a format compatible with the Hugging Face library.</p><h4>Model Architecture:</h4><p>We leverage TinyBERT (huawei-noah/TinyBERT_General_4L_312D) for our classification task. We adjusted the model&#39;s configurations to match the dataset&#39;s needs:</p><ul><li>Max Position Embeddings: Adjusted to 2048 for longer sequences.</li><li>Number of Labels: Set dynamically based on the dataset.</li><li>Quantization: Configured 4-bit quantization using BitsAndBytesConfig with NF4 type.</li></ul><h4>Training Procedure:</h4><ul><li>Tokenizer: We used AutoTokenizer to tokenize the dataset efficiently.</li><li>Quantization and Optimization: By utilizing 4-bit quantization and low-rank adaptation, the model could handle large datasets with reduced resource consumption while maintaining performance.</li></ul><h4>Conclusion:</h4><p>This work presents a method to optimize BERT-based models for text classification, specifically tailored to news datasets. By implementing QLoRA and quantization techniques, we demonstrate the feasibility of using TinyBERT models for efficient and accurate classification tasks.</p><p>References</p><p>You can find the data from <a href="https://www.kaggle.com/competitions/learn-ai-bbc/data">here</a></p><p>The github for the code <a href="https://github.com/baharaks/tinybert_qlora/tree/master">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e46bbcc0f166" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generative Adversarial Network (GAN) to denoise images]]></title>
            <link>https://medium.com/@baharak.soltanian/generative-adversarial-network-gan-to-denoise-images-126f06bdd41b?source=rss-8557ff556d45------2</link>
            <guid isPermaLink="false">https://medium.com/p/126f06bdd41b</guid>
            <category><![CDATA[generative-adversarial]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Becky Soltanian]]></dc:creator>
            <pubDate>Wed, 03 Apr 2024 21:48:12 GMT</pubDate>
            <atom:updated>2024-04-03T21:49:14.775Z</atom:updated>
            <content:encoded><![CDATA[<p>In the heart of our latest endeavor lies a fusion of generative adversarial networks (GANs) and state-of-the-art semantic segmentation models, aimed at the ambitious task of denoising images. Our approach harnesses the power of Deep Convolutional GANs (DCGANs), with a twist in the generator architecture to incorporate the robustness of DeepLabV3, a leading model in semantic image segmentation. This innovative blend is designed not just to generate aesthetically pleasing synthetic images but to restore real-world images marred by noise, bringing them closer to their pristine, noise-free state.</p><p>The crux of our methodology revolves around a custom adaptation of the DeepLabV3 model to serve as the generator within the GAN framework. By stripping away the final classification layer of DeepLabV3 and repurposing its deep, rich feature extraction capabilities, we’ve tailored it for the task of image denoising. This adaptation allows the generator to focus on capturing and reconstructing the essential details of the input images, facilitating the removal of noise while preserving the underlying content and context. The discriminator, on the other hand, is built upon a conventional convolutional neural network (CNN) structure, fine-tuned to distinguish between the denoised images produced by the generator and the original noise-free images. This adversarial setup pushes the generator towards producing increasingly accurate and realistic denoised images, effectively learning the subtleties of what constitutes a clean image.</p><p>The interplay between the adapted DeepLabV3 generator and the CNN-based discriminator forms the backbone of our DCGAN approach to image denoising by learning the noise. Preliminary results have been promising, showcasing the model’s capability to reduce noise significantly while maintaining the integrity and sharpness of the original images. This technique not only opens new avenues for image restoration and enhancement but also underscores the versatility of combining powerful models from different domains to tackle complex challenges in image processing. As we continue to refine our approach, we’re excited about the potential applications and improvements this model could bring to various fields, from medical imaging to surveillance and beyond.</p><p>References:</p><ol><li>github code: <a href="https://github.com/baharaks/denoise_gan">https://github.com/baharaks/denoise_gan</a></li><li>dataset: <a href="https://ieee-dataport.org/open-access/virtual-sar-synthetic-dataset-deep-learning-based-speckle-noise-reduction-algorithms">https://ieee-dataport.org/open-access/virtual-sar-synthetic-dataset-deep-learning-based-speckle-noise-reduction-algorithms</a></li><li>Deeplabv3: <a href="https://paperswithcode.com/method/deeplabv3#:~:text=DeepLabv3%20is%20a%20semantic%20segmentation,by%20adopting%20multiple%20atrous%20rates">https://paperswithcode.com/method/deeplabv3#:~:text=DeepLabv3%20is%20a%20semantic%20segmentation,by%20adopting%20multiple%20atrous%20rates</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=126f06bdd41b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Combitorial AI: Leveraging CNN and Unsupervised Machine Learning for Data Annotation and Clustering]]></title>
            <link>https://medium.com/@baharak.soltanian/combitorial-ai-leveraging-cnn-and-unsupervised-machine-learning-for-data-annotation-and-clustering-ecb33f17f4e5?source=rss-8557ff556d45------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecb33f17f4e5</guid>
            <category><![CDATA[mls]]></category>
            <category><![CDATA[k-means-clustering]]></category>
            <category><![CDATA[cnn-model]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[pca-analysis]]></category>
            <dc:creator><![CDATA[Becky Soltanian]]></dc:creator>
            <pubDate>Wed, 17 Jan 2024 02:20:26 GMT</pubDate>
            <atom:updated>2024-02-28T22:20:58.022Z</atom:updated>
            <content:encoded><![CDATA[<p>Combinatorial AI: Leveraging CNN and Unsupervised Machine Learning for Data Annotation and Clustering</p><p>In the realm of machine learning, the integration of different methodologies often leads to more robust and efficient solutions. In a recent project, I combined Convolutional Neural Networks (CNNs) with unsupervised machine learning techniques to tackle the challenge of data annotation and clustering. This multi-faceted approach was particularly tailored to handle a scenario where training data was sparse, a common obstacle in machine learning tasks.</p><ol><li>Annotating the Data with CNN and Unsupervised Learning</li></ol><p>The first step in this process was to annotate the data, which forms the foundation for any machine learning model. To accomplish this, I utilized a combination of CNN and unsupervised learning techniques. The use of a pretrained VGG16 model was pivotal for feature extraction. VGG16, known for its simplicity and depth, is effective in identifying and extracting features from images, which is crucial for any task that involves image data.</p><p>2. Feature Reduction and Clustering</p><p>With the features extracted using VGG16, the next challenge was to manage the dimensionality of our data. High dimensionality can lead to overfitting and increased computational costs. To counter this, I employed Principal Component Analysis (PCA). PCA is a statistical technique that transforms the data into a set of linearly uncorrelated components, thereby reducing the number of features while retaining most of the valuable information.</p><p>Once the features were streamlined, I applied K-means clustering. K-means is an unsupervised learning algorithm used for clustering data into K number of clusters. In this case, I chose to form 2 clusters due to the sparse nature of the training data. This decision was crucial in ensuring that the model did not become overwhelmed by the data sparsity and could still find meaningful patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*t1RkO8_uEZihWa1-2gFoFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*mD39NiS_yz_iNLOaslafpQ.png" /><figcaption>Fig 1 Left results for cluster 0 and right for cluster 1</figcaption></figure><p>3. Designing and Implementing a Two-Layer CNN</p><p>Following the data preparation stage, the focus shifted to designing and implementing a two-layer CNN. This neural network was tailor-made to suit the specific requirements of the project. The two-layer architecture was chosen for its balance between simplicity and effectiveness, providing enough complexity to learn from the data without being overly prone to overfitting.</p><pre>class RoofNet(nn.Module):<br>    def __init__(self):<br>        super(RoofNet, self).__init__()<br><br>        # Convolution 1<br>        self.cnn1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size=5, stride=1, padding=2)<br>        self.relu1 = nn.ReLU()<br><br>        # Max pool 1<br>        self.maxpool1 = nn.MaxPool2d(kernel_size=2)<br><br>        # Convolution 2<br>        self.cnn2 = nn.Conv2d(in_channels=16, out_channels=32, kernel_size=5, stride=1, padding=2)<br>        self.relu2 = nn.ReLU()<br><br>        # Max pool 2<br>        self.maxpool2 = nn.MaxPool2d(kernel_size=2)<br><br>        # Fully connected 1 (readout)<br>        self.fc1 = nn.Linear(32 * 40 * 40, 2) <br><br>    def forward(self, x):<br>        # Convolution 1<br>        out = self.cnn1(x)<br>        out = self.relu1(out)<br><br>        # Max pool 1<br>        out = self.maxpool1(out)<br><br>        # Convolution 2 <br>        out = self.cnn2(out)<br>        out = self.relu2(out)<br><br>        # Max pool 2 <br>        out = self.maxpool2(out)<br><br>        out = out.view(out.size(0), -1)<br><br>        # Linear function (readout)<br>        out = self.fc1(out)<br><br>        return out</pre><p>4. Training, Validation, and Testing</p><p>The model was then trained using a train-validation dataset. The training phase is where the model learns to make predictions, and the validation phase is crucial for tuning the hyperparameters and preventing overfitting. Once the model was adequately trained and validated, it was tested on a separate dataset named “test.” This step is essential to evaluate the model’s performance on unseen data, ensuring its effectiveness and generalizability.</p><p>5. Results and Documentation</p><p>In conclusion, this project demonstrated how a combination of CNN and unsupervised machine learning techniques could be effectively employed in scenarios with sparse training data. The methodical approach of using pretrained models for feature extraction, PCA for dimensionality reduction, K-means for clustering, and a custom-designed CNN proved to be a robust strategy for tackling data annotation and clustering challenges.</p><p>References:</p><p>You can find the code for this mini-project in this <a href="https://github.com/baharaks/roof_top_classification">github</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecb33f17f4e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to combine different models to get better result?]]></title>
            <link>https://medium.com/@baharak.soltanian/how-to-combine-different-models-to-get-better-result-bcb7b1bdb90a?source=rss-8557ff556d45------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcb7b1bdb90a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deeplearing]]></category>
            <category><![CDATA[combinatorial-ai]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Becky Soltanian]]></dc:creator>
            <pubDate>Sat, 06 Jan 2024 04:38:08 GMT</pubDate>
            <atom:updated>2024-01-06T04:38:08.323Z</atom:updated>
            <content:encoded><![CDATA[<p>In the life of an AI engineer, encountering sparse training data is a common challenge. Often, you find yourself wishing for more extensive, less noise-affected data. The general strategy is to invest time in gathering additional data, ensuring precise annotations, or augmenting the existing dataset. But what if time is a constraint and you need to impress a crucial client within a day or two? I propose a solution, which I detail below. This marks the first installment of a series on combinatorial AI modeling, aimed at achieving quick yet effective results.</p><p>The project’s goal is to segment a limited dataset and identify solar panels on rooftops. Initially, I fine-tuned Meta’s “Segment Anything Model” (SAM) using a solar panel dataset from the Roboflow platform. As Figure 1 illustrates, SAM segments various objects, but it does not create the binary mask required and occasionally fails to segment the solar panels. A review of SAM’s official GitHub revealed that the model’s performance improves when supplemented with additional points from the targeted object or area, serving as anchor points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*0P3A-LUdrv-OoOdl-vdWLg.png" /><figcaption>Fig. 1 The overal block diagram of the system</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*xj4ZwTczjZkiYacaRJ9m9Q.jpeg" /><figcaption>Fig. 2 Original image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*b-y4xKUhFy6DsSL-lqjp5Q.jpeg" /><figcaption>Fig. 3The output from SAM</figcaption></figure><p>The subsequent phase involved developing a method to automatically detect anchor points. To achieve this, I utilized a pretrained model specifically designed for identifying solar panels. For this task, I employed <a href="https://universe.roboflow.com/roboflow-100/solar-panels-taxvb">Roboflow</a>’s YOLOv8 model, which has been trained on their Solar Panel dataset. As demonstrated in Figure 4, this model is capable of detecting solar panels. However, it occasionally identifies only portions of the panel or detects the cells individually, rather than the panel as a whole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*bdo3gjiI21R1EszATp0Q8w.jpeg" /><figcaption>Fig. 4 The output of YOLOv8 from Roboflow plotform</figcaption></figure><p>Now, the centers of the bounding boxes identified by YOLOv8 can be utilized as anchor points for SAM. This integration strategy allows for the leveraging of YOLOv8’s detection capabilities to enhance SAM’s performance. Figure 5 presents the outcome of combining YOLOv8 with SAM, where the centers of the bounding boxes serve as the anchor points, demonstrating the effectiveness of this combined approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*E9vZcAHf4QMwIz4qVkkhAw.jpeg" /><figcaption>Fig. 5 The result from SAM + YOLOv8</figcaption></figure><p>Future steps</p><ol><li>Collect more diverse dataset with proper annotation suitable for YOLOv8 and train the model in house.</li><li>Design and handcraft a deep neural network to detect the solar panels and segment the images.</li></ol><p>References</p><ol><li>For more information on YOLOv8 read this <a href="https://medium.com/@ituagmai/computer-vision-part-1-yolov8-train-and-infer-8572aabdb014">medium publication</a>.</li><li>The codes can be found <a href="https://github.com/baharaks/SAM_transfer_learning">here</a>.</li><li>Get the fine-tuned SAM from <a href="https://drive.google.com/file/d/1ur3jrJac5kK1qx_Mq5W_l0PNZZJ_Pkgm/view?usp=sharing">here</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcb7b1bdb90a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>