<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: anne sonia</title>
    <description>The latest articles on DEV Community by anne sonia (@anne_sonia).</description>
    <link>https://dev.to/anne_sonia</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4152142%2F8e538bb6-742c-4aa5-bae5-9570e217d4d8.png</url>
      <title>DEV Community: anne sonia</title>
      <link>https://dev.to/anne_sonia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anne_sonia"/>
    <language>en</language>
    <item>
      <title>Introduction to Computer Vision</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Tue, 13 Oct 2026 13:13:46 +0000</pubDate>
      <link>https://dev.to/anne_sonia/introduction-to-computer-vision-3m2m</link>
      <guid>https://dev.to/anne_sonia/introduction-to-computer-vision-3m2m</guid>
      <description>&lt;p&gt;Computer vision is the technology that teaches computers to understand pictures and videos. Look at a photo of a coffee cup and you know right away what it is. You may even guess the coffee is hot. A computer sees none of that. It sees only numbers, and computer vision is the set of ideas that turns those numbers into meaning.&lt;br&gt;
In this post, we explain how computers "see", the main tasks they can do, why this field is growing so fast, and how it is already helping people across Africa.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;What a computer really sees&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
A digital photo is a grid of tiny squares called pixels. Each pixel is stored as three numbers: how much red, green and blue it contains. Each number goes from 0 to 255.&lt;br&gt;
So even a small photo, 400 pixels wide and 600 pixels tall, holds 400 × 600 × 3 = 720,000 numbers. A modern phone photo holds more than 30 million. The big challenge of computer vision is to go from all these numbers to real meaning.&lt;/p&gt;

&lt;p&gt;You can think of a colour image as three grids stacked on top of each other: one for red, one for green and one for blue. A red cup looks bright in the red grid and dark in the blue grid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Three questions every vision system answers&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Computer vision lets computers get meaning from images and video. Almost every system answers one or more of these questions:&lt;br&gt;
• What is in the picture? For example, a cat or a cassava leaf.&lt;br&gt;
• Where is it? Which part of the picture, or which pixels.&lt;br&gt;
• What is happening? For example, a person crossing the road. This is mostly for video.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Humans and computers see differently&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Humans&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Years of seeing the world
2.Understanding context, learning from few examples
3.Getting tired
&lt;strong&gt;Computers&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Millions of labelled images
2.Speed and working at large scale
3.Things that look different from their training images&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A computer can check thousands of X-rays in a day without getting tired. But it can easily fail on something it has never seen before. We will come back to this later.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Five core tasks&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Most computer vision work falls into five tasks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Classification: give one label to the whole image.&lt;/li&gt;
&lt;li&gt;Detection: draw a box around each object.&lt;/li&gt;
&lt;li&gt;Segmentation: give a label to every single pixel.&lt;/li&gt;
&lt;li&gt;OCR: read the text inside an image.&lt;/li&gt;
&lt;li&gt;Tracking: follow objects from one video frame to the next.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is an example. Take one photo of a street. A classifier may say "minibus" and be 57% sure. That is not wrong, but it is not very useful. A detector will find one bus and four people and draw boxes around them. A segmenter will outline exactly which pixels belong to each object. The more detail you want, the more detailed the training labels must be, and the more it costs to create them.&lt;br&gt;
&lt;strong&gt;How a computer finds patterns&lt;/strong&gt;&lt;br&gt;
The first step is to find edges, the places where brightness changes. To do this, we use a filter. A filter is a small grid of numbers. We slide it over the image, multiply each pixel by the matching number, and add up the results. This operation is called convolution.&lt;br&gt;
Here is a simple example. The filter below is called a Sobel filter. It subtracts the left side from the right side:&lt;br&gt;
-1,0,1&lt;br&gt;
-2,0,2&lt;br&gt;
-1,0,1&lt;br&gt;
• On a flat area where every pixel is 100, the left side gives −400 and the right side gives +400. The total is 0, so there is no edge.&lt;br&gt;
• On an area that goes from dark (0) to bright (200), the left side gives 0 and the right side gives +800. The big number tells us there is an edge.&lt;br&gt;
Other filters can blur a picture or make it sharper. In code, a blur is just a 5 × 5 grid of ones divided by 25, which means each pixel becomes the average of the 25 pixels around it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8wo4cyssb511g642vyd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8wo4cyssb511g642vyd5.png" alt="how a computer find pattern" width="800" height="463"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Letting the computer learn its own filters&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
In the past, people designed filters by hand. Today we use a convolutional neural network (CNN), which learns its own filters from labelled examples. Nobody designs them. The network builds up understanding step by step:&lt;br&gt;
Pixels → Edges → Textures → Objects&lt;br&gt;
The first layers find simple edges and colours. The middle layers find textures and parts, like eyes or wheels. The last layers recognise whole objects.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Finding objects fast with YOLO&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Older detectors, such as R-CNN, worked in two steps. First they looked for regions that might contain an object, then they classified each region. This was accurate but slow.&lt;br&gt;
YOLO stands for "You Only Look Once". It looks at the whole image one time and predicts every box and label together. This is fast enough for live video and for small devices. It was introduced in 2015 by Joseph Redmon and his colleagues.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Why computer vision is growing now&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Five things came together at the same time:&lt;br&gt;
• Cameras everywhere: every phone is a camera and a small computer.&lt;br&gt;
• Data: there are huge image collections, including satellite images of whole continents.&lt;br&gt;
• Computing power: cloud GPUs train big models, and small models can run on cheap phones with no internet.&lt;br&gt;
• Pretrained models: you do not start from zero. You can adapt an existing model with a few thousand local photos.&lt;br&gt;
• Multimodal AI: AI assistants can now read images as well as text.&lt;br&gt;
There is also a link with language AI. A Vision Transformer cuts an image into small 16 × 16 patches and treats each patch like a word. A 224 × 224 image becomes 196 patches. Then the same attention method used for text reads the picture.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Computer vision across Africa&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Computer vision is already solving real problems on the continent. Here are six examples.&lt;br&gt;
• Farming (East Africa): The Nuru app helps farmers find crop diseases. A farmer takes a photo of a cassava leaf and the app names the disease and gives advice. It works offline on a basic phone, so it is useful in fields with no internet. Task: image classification.&lt;br&gt;
• Health (Nigeria): In 2022, software scored the chest X-rays of 5,298 people in Gombe and Adamawa. People with a high score got a lab test, and 85 people with TB were found. Task: classification with a threshold.&lt;br&gt;
• Conservation (Gabon): A small computer next to a camera trap spots elephants and people, then sends an alert to rangers by satellite within minutes. Task: object detection "at the edge", meaning on the device itself.&lt;br&gt;
• Finance (6 countries): Smile ID matches a selfie to an ID photo and checks that the person is real and live. It handled more than 1 million identity checks per month in 2021. Tasks: face verification and OCR.&lt;br&gt;
• Mapping (whole continent): Google's Open Buildings project found 1.8 billion building outlines from satellite images. Health teams use them to plan vaccination campaigns, and aid teams use them after floods. Task: segmentation.&lt;br&gt;
• Accessibility (Kigali): BLAIVA, built by FabLab Rwanda and still in beta testing, is a wearable camera that describes objects, text and faces through earphones. Tasks: detection, OCR and face recognition.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;When computer vision fails&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
A model only knows what it was trained on. In one test on a street photo, the model found "1 bus, 4 people". Then the photo was changed:&lt;br&gt;
• Very dark: the model added a skateboard that was not there.&lt;br&gt;
• Upside down: the model missed the bus.&lt;br&gt;
• Very low resolution: the model found nothing.&lt;br&gt;
Many popular models were trained mostly on photos from Europe, North America and Asia. They can make more mistakes on African crops, clothes, roads, skin tones and lighting. Early face recognition systems, for example, often worked worse on darker skin because the training data was not representative. Face data is also very private, so it needs great care.&lt;br&gt;
The fix is local data. When a model is adapted with local photos, it works better for local people. It is also important to ask who could be harmed if a model is wrong: a farmer, a patient or a customer.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Tools to get started&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
You rarely need to start from zero. These tools are popular:&lt;br&gt;
• PyTorch: build and train your own neural networks.&lt;br&gt;
• TensorFlow / Keras: Google's alternative, common in mobile apps.&lt;br&gt;
• Hugging Face: download pretrained models and adapt them.&lt;br&gt;
• Ultralytics YOLO: ready-made detection, classification and segmentation.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Key takeaways&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
• Images are just numbers: height × width × 3.&lt;br&gt;
• Filters find patterns, and CNNs learn the filters by themselves.&lt;br&gt;
• The main tasks are classification, detection and segmentation.&lt;br&gt;
• Computer vision is already used in farming, health, conservation, finance, mapping and accessibility across Africa.&lt;br&gt;
• Models fail on things they have not seen, so local data matters.&lt;br&gt;
A good way to start is to take 5 to 10 photos of your own surroundings, such as a street, a market stall or a crop leaf, and run them through a pretrained model. Notice what it gets right and what it misses. That is the best way to understand both the power and the limits of computer vision.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>computerscience</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Word Embeddings: How Machines Learn the Meaning Behind Words</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Wed, 30 Sep 2026 12:54:46 +0000</pubDate>
      <link>https://dev.to/anne_sonia/word-embeddings-how-machines-learn-the-meaning-behind-words-4355</link>
      <guid>https://dev.to/anne_sonia/word-embeddings-how-machines-learn-the-meaning-behind-words-4355</guid>
      <description>&lt;p&gt;When I started learning Natural Language Processing (NLP), one of the things that confused me was a simple question: How can a computer understand the meaning of words?&lt;/p&gt;

&lt;p&gt;Computers work with numbers, but humans communicate using words, sentences, and different ways of expressing the same idea. This became especially interesting to me when I started building a simple FAQ chatbot for a clothing shop.&lt;/p&gt;

&lt;p&gt;My first approach used TF-IDF to represent questions. It worked by looking at the words in a question and comparing them with the words in stored FAQ questions. But I wanted my chatbot to understand more than just matching words.&lt;/p&gt;

&lt;p&gt;That is where word embeddings became important.&lt;/p&gt;

&lt;p&gt;What are word embeddings?&lt;/p&gt;

&lt;p&gt;Word embeddings are numerical representations of words or pieces of text. Instead of representing a word only as a label such as "dress", an embedding represents it as a vector of numbers.&lt;/p&gt;

&lt;p&gt;For example, we can imagine:&lt;/p&gt;

&lt;p&gt;dress → [0.21, -0.14, 0.73, 0.42, ...]&lt;br&gt;
shirt → [0.19, -0.10, 0.68, 0.39, ...]&lt;br&gt;
car   → [-0.51, 0.83, -0.22, 0.11, ...]&lt;/p&gt;

&lt;p&gt;The actual vectors contain many more dimensions, and the numbers are learned from data.&lt;/p&gt;

&lt;p&gt;The important idea is that words or sentences with related meanings can have vectors that are closer together in the embedding space.&lt;/p&gt;

&lt;p&gt;This is useful because language is not only about exact words. Two people can ask the same question using completely different wording.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;"What is the price of this dress?"&lt;/p&gt;

&lt;p&gt;and:&lt;/p&gt;

&lt;p&gt;"How much does this dress cost?"&lt;/p&gt;

&lt;p&gt;They are different sentences, but they have almost the same meaning.&lt;/p&gt;

&lt;p&gt;A system based only on exact word matching can have difficulty with this. Embeddings help us represent semantic relationships.&lt;/p&gt;

&lt;p&gt;Word2Vec&lt;/p&gt;

&lt;p&gt;One of the important embedding methods I learned about is Word2Vec.&lt;/p&gt;

&lt;p&gt;Word2Vec was introduced by Mikolov and colleagues in 2013. It learns vector representations of words from their surrounding context. The basic idea is that words appearing in similar contexts tend to develop similar representations.&lt;/p&gt;

&lt;p&gt;There are two well-known Word2Vec approaches:&lt;/p&gt;

&lt;p&gt;CBOW (Continuous Bag of Words)&lt;br&gt;
Skip-gram&lt;/p&gt;

&lt;p&gt;CBOW uses surrounding words to predict a target word.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;"The customer bought a new ___ yesterday."&lt;/p&gt;

&lt;p&gt;The surrounding context can help the model predict a word such as:&lt;/p&gt;

&lt;p&gt;dress&lt;/p&gt;

&lt;p&gt;Skip-gram works in the opposite direction. It uses a target word to predict words that are likely to appear around it.&lt;/p&gt;

&lt;p&gt;During training, the model learns vectors that capture relationships between words.&lt;/p&gt;

&lt;p&gt;One famous type of example associated with word embeddings is:&lt;/p&gt;

&lt;p&gt;king - man + woman ≈ queen&lt;/p&gt;

&lt;p&gt;The interesting part is that the vectors can capture relationships rather than simply storing dictionary definitions.&lt;/p&gt;

&lt;p&gt;Why do embeddings matter?&lt;/p&gt;

&lt;p&gt;Embeddings are useful because many NLP problems require understanding relationships between words and text.&lt;/p&gt;

&lt;p&gt;They can be used for:&lt;/p&gt;

&lt;p&gt;Semantic search&lt;br&gt;
Question answering&lt;br&gt;
Chatbots&lt;br&gt;
Text classification&lt;br&gt;
Recommendation systems&lt;br&gt;
Similarity detection&lt;br&gt;
Information retrieval&lt;br&gt;
Clustering&lt;/p&gt;

&lt;p&gt;For my FAQ chatbot, the most important use is semantic similarity.&lt;/p&gt;

&lt;p&gt;Imagine a clothing customer asks:&lt;/p&gt;

&lt;p&gt;"Do you have something I can wear to a party?"&lt;/p&gt;

&lt;p&gt;The FAQ database might contain:&lt;/p&gt;

&lt;p&gt;"Do you sell party clothes?"&lt;/p&gt;

&lt;p&gt;The two questions don't contain exactly the same words, but their meanings are related.&lt;/p&gt;

&lt;p&gt;This is the kind of problem where embeddings can be useful.&lt;/p&gt;

&lt;p&gt;From TF-IDF to embeddings in my chatbot&lt;/p&gt;

&lt;p&gt;My first chatbot version used TF-IDF.&lt;/p&gt;

&lt;p&gt;TF-IDF converts text into numerical vectors based mainly on the importance of words in the documents. I then used cosine similarity to find the FAQ question most similar to the user's question.&lt;/p&gt;

&lt;p&gt;The improved version uses a pre-trained Sentence Transformer model:&lt;/p&gt;

&lt;p&gt;from sentence_transformers import SentenceTransformer&lt;/p&gt;

&lt;p&gt;model = SentenceTransformer(&lt;br&gt;
    "sentence-transformers/all-MiniLM-L6-v2"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;questions = [&lt;br&gt;
    "Do you sell party clothes?",&lt;br&gt;
    "What sizes do you have?",&lt;br&gt;
    "How can I order clothes?"&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;embeddings = model.encode(questions)&lt;/p&gt;

&lt;p&gt;print(embeddings.shape)&lt;/p&gt;

&lt;p&gt;The Sentence Transformers documentation shows the same basic workflow: load a pretrained model, encode text into embeddings, and compare the resulting vectors for similarity. The all-MiniLM-L6-v2 model produces 384-dimensional embeddings.&lt;/p&gt;

&lt;p&gt;For example, my chatbot can encode both the customer's question and the stored FAQ questions, then compare their vectors.&lt;/p&gt;

&lt;p&gt;from sklearn.metrics.pairwise import cosine_similarity&lt;/p&gt;

&lt;p&gt;user_question = model.encode(&lt;br&gt;
    ["How much does a dress cost?"]&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;similarities = cosine_similarity(&lt;br&gt;
    user_question,&lt;br&gt;
    embeddings&lt;br&gt;
)[0]&lt;/p&gt;

&lt;p&gt;best_index = similarities.argmax()&lt;/p&gt;

&lt;p&gt;print(questions[best_index])&lt;br&gt;
print(similarities[best_index])&lt;/p&gt;

&lt;p&gt;The chatbot can then return the FAQ answer associated with the question having the highest similarity.&lt;/p&gt;

&lt;p&gt;What surprised me&lt;/p&gt;

&lt;p&gt;The most interesting thing I learned is that similar meaning does not always require the same words.&lt;/p&gt;

&lt;p&gt;Before learning about embeddings, I mainly thought of text as words that needed to be matched. Embeddings changed how I think about NLP.&lt;/p&gt;

&lt;p&gt;For example, these questions are different:&lt;/p&gt;

&lt;p&gt;"How much is a dress?"&lt;br&gt;
"What is the price of a dress?"&lt;br&gt;
"How expensive is that dress?"&lt;/p&gt;

&lt;p&gt;A human immediately understands that they are asking about the same thing.&lt;/p&gt;

&lt;p&gt;The goal of semantic embeddings is to represent that relationship numerically.&lt;/p&gt;

&lt;p&gt;What I struggled with&lt;/p&gt;

&lt;p&gt;One challenge was understanding what the numbers in an embedding actually mean.&lt;/p&gt;

&lt;p&gt;At first, seeing a vector such as:&lt;/p&gt;

&lt;p&gt;[0.034, -0.218, 0.731, ...]&lt;/p&gt;

&lt;p&gt;does not tell us anything directly. The meaning is not stored in one specific number. Instead, useful information is distributed across the vector, and relationships can be studied by comparing vectors.&lt;/p&gt;

&lt;p&gt;I also learned that choosing an embedding model matters. Different models can behave differently depending on the task and the data. A model that works well for general semantic similarity may not automatically be perfect for a specific FAQ dataset.&lt;/p&gt;

&lt;p&gt;What I learned from the project&lt;/p&gt;

&lt;p&gt;Building the clothing-shop FAQ chatbot helped me understand why embeddings are important in practical NLP systems.&lt;/p&gt;

&lt;p&gt;TF-IDF is simple, fast, and useful when important keywords are enough to identify the correct answer.&lt;/p&gt;

&lt;p&gt;Embeddings provide another way to represent text by capturing semantic relationships. This can be especially useful when users express the same idea using different words.&lt;/p&gt;

&lt;p&gt;The next step in my project is to evaluate both approaches using the same test questions and compare their results.&lt;/p&gt;

&lt;p&gt;For me, word embeddings are not just another machine learning technique. They are a way of moving from thinking about text as a collection of individual words toward thinking about relationships and meaning in language.&lt;/p&gt;

&lt;p&gt;Sources&lt;br&gt;
Mikolov et al., Efficient Estimation of Word Representations in Vector Space (2013).&lt;br&gt;
Mikolov et al., Distributed Representations of Words and Phrases and their Compositionality (2013).&lt;br&gt;
Sentence Transformers documentation, Quickstart and Computing Embeddings.&lt;br&gt;
&lt;strong&gt;REFERENCES&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mikolov, T., Chen, K., Corrado, G., &amp;amp; Dean, J. (2013). Efficient Estimation of Word Representations in Vector Space. arXiv. &lt;a href="https://arxiv.org/abs/1301.3781" rel="noopener noreferrer"&gt;https://arxiv.org/abs/1301.3781&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pennington, J., Socher, R., &amp;amp; Manning, C. D. (2014). GloVe: Global Vectors for Word Representation. Proceedings of EMNLP 2014. &lt;a href="https://aclanthology.org/D14-1162/" rel="noopener noreferrer"&gt;https://aclanthology.org/D14-1162/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sentence Transformers Documentation. Quickstart. &lt;a href="https://www.sbert.net/docs/quickstart.html" rel="noopener noreferrer"&gt;https://www.sbert.net/docs/quickstart.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sentence Transformers. all-MiniLM-L6-v2. Hugging Face. &lt;a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2" rel="noopener noreferrer"&gt;https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  nlp #machinelearning #python
&lt;/h1&gt;

</description>
      <category>ai</category>
      <category>learning</category>
      <category>machinelearning</category>
      <category>nlp</category>
    </item>
  </channel>
</rss>
