Tag: artificial-intelligence

  • How to Build An AI Caption Generator

    Rather than discussing AI related topics, this week I wanted to try something out, building a simple AI tool that can generate captions for images. I was able to complete this in under 45-minutes, and I’m going to walk you through the process, step-by-step.

    Step 1: Setting up the Folder in Terminal

    First things first, I opened Terminal on my Mac (you can find it in Applications > Utilities). Then, I ran these commands to create a folder and go inside it:

    • mkdir ai-image-captioning
    • cd ai-image-captioning

    This creates an empty folder to store everything for the AI model.

    Step 2: Setting up VS Code

    I opened up VS Code directly from the Terminal by typing:

    • code .

    This opens up VS Code in the current folder, ai-image-captioning. If you don’t have VS Code already downloaded, you can do that on the website.

    Step 3: Downloading AI Model and Script

    I wasn’t sure where the script was, so I had to find a way to call the caption generator script for the AI. So, I found a GitHub repository that had the necessary script and cloned it to my folder by doing:

    Once that was completed, the script for caption_generator.py was ready

    Step 4: Installing the Python Libraries That Are Needed

    The caption_generator.py script needs a few Python libraries to work, so I installed them using this code (your code will not run unless you download these!):

    • pip3 install torch torchvision matplotlib pillow requests

    These libraries help with everything from image handling to deep learning.

    Step 5: Running the Caption Generator

    And with that you’re done with the coding aspect. All you need to do is execute the code using:

    • python3 caption_generator.py

    After doing so, it prompted me to enter an image URL, so I found a picture of a dog online and copied the URL.

    Step 6: AI Generates the Caption

    Once I hit Enter, the AI processed the image and generated this caption:

    • “Generated Caption: a dog sitting in the grass”

    Now you’re done! You have successfully completed making an AI caption generator.

    But, how does this work?

    Make sure to read my next post to find out all about this. 🙂

    Resource:

    Wang, Jim. “What Is Image Captioning and How to Use Python to Generate Caption from an Image?” Medium, Medium, 14 Sept. 2024, medium.com/@jimwang3589/what-is-image-captioning-and-how-to-use-python-to-generate-caption-from-an-image-98a9eb6be06d. 

  • Matrices in Artificial Intelligence

    When people think about AI, they usually think of ChatGPT, self-driving cars, or robots. However, behind all of this intelligence is something that may seem boring at first, matrices. Even though they just look like grids of numbers, they are actually one of the most important tools in AI. They help machines process information, recognize patterns, and make decisions.

    Simply put, a matrix is a set of numbers arranged in rows and columns. Here’s an example of a simple 4×4:

    How AI Uses Matrices:

    Storing and Processing Data: to deal with large amount of data, AI models use matrices to help organize it

    • Ex: Images are made up of tiny pixels, and each pixel has a brightness value. These values can be stored in a matrix, allowing AI to analyze the image and see patterns

    Editing and Transforming Images: AI uses a type of matrices, transformation matrices, to move, rotate, or stretch images while keeping everything else aligned

    • Ex: In Instagram or Snapchat filters, transformation matrices are used to make sure the filter stays in place even when you move your head.

    Neural Networks and Matrix Multiplication: Neural networks are essentially the “brains” of AI, and they reply on matrix multiplication to process information.

    • Ex: Every connection between neurons (small units in AI models), are stored in a matrix. When AI learns, it’s basically just adjusting the values to improve accuracy.

    Understanding Language: AI chatbots do not just memorize words, instead they use matrices to predict what word should come next. Every word in a sentence can be converted into a vector, a type of matrix, and AI compares these to form possible responses

    • Ex: When you are using ChatGPT and it gives you possible questions to ask as you are typing, it is using vector matrices to predict what you are asking.

    Why do Matrices Matter?

    They are the foundation of AI! Every single time you use Google Translate, scroll through your FYP on TikTok, use a Snap or Instagram filter, or talk to a chatbot, you’re using AI powered matrices!

    Resources

    Labelbox. “Inside the Matrix: A Look into the Math Behind AI.” Labelbox Blog, 12 Sept. 2023, https://labelbox.com/blog/inside-the-matrix-a-look-into-the-math-behind-ai/.

    “Matrices and Matrix Arithmetic for Machine Learning.” GeeksforGeeks, https://www.geeksforgeeks.org/matrices-and-matrix-arithmetic-for-machine-learning/.

    “What Types of Matrix Multiplication Are Used in Machine Learning? When Are They Used?” Data Science Stack Exchange, 30 July 2020, https://datascience.stackexchange.com/questions/75855/what-types-of-matrix-multiplication-are-used-in-machine-learning-when-are-they.

    “Image Transformation Using Matrix.” Pixls.us Discussion, 15 Aug. 2022, https://discuss.pixls.us/t/image-transformation-using-matrix/30786.

  • February’s Technological Breakthroughs

    February was a month full of technological advances and challenges, especially in quantum computing, AI, and cybersecurity.

    Amazon’s Ocelot Quantum Chip

    With the help of AWS (Amazon Web Services) cloud division, Amazon was able to release its first quantum computing chip, named “Ocelot”. This prototype looks to address challenges in quantum computing, especially correcting errors and scalability. The Ocelot chips uses “cat qubits,” to suppress qubit bit-flip errors, which ultimately reduces the overall errors in quantum systems. This development puts Amazon next to other tech giants like Microsoft and Google, who are also taking big leaps in the quantum computing field.

    Microsoft’s Majorana 1 and Google’s Willow Chips

    Microsoft released its “Majorana 1” chip, and Google introduced its “Willow” chip, both signaling significant strides in quantum computing. Both chips use quantum physics to process information in a completely new way, underscoring the growing interest and investment in quantum computing from big companies.

    Google’s Gemini 2.0 Pro

    Google made AI advancements following the release of Gemini 2.0 Pro, which introduces even more AI benefits, including enhanced capabilities and user experiences. This update brings a larger context window, allowing over 1 million tokens to be processed at once, making it highly efficient. The Gemini mobile app now includes Deep Research, a features that allows users to go deeper into topics with AI assistance, summarizing research papers, and generating insights almost immediately. Gemini 2.0 Pro is also able to analyze text, images, and even videos.

    Cybersecurity Concerns

    With AI models gaining more power, many concerns regarding security and data are rising. Reports show that almost 45% of AI breaches in the past year are coming from malware in public models. Also, government agencies are now facing scrutiny over how AI systems access and store private data. As AI becomes used more in daily life, it’s necessary to balance innovation with security.

    February was a transformative month for technology, and I’m sure there will be many more advancements in the next month.

    Resources:

    Nellis, Stephen. “Amazon Unveils Quantum Chip, Aiming to Shave Years off Development Time.” Arizona Digital Free Press, 3 Mar. 2025, arizonadigitalfreepress.com/amazon-unveils-quantum-chip-aiming-to-shave-years-off-development-time/. 

    19, Written by Catherine Bolgar                Published      February, et al. “Microsoft’s Majorana 1 Chip Carves New Path for Quantum Computing.” Microsoft, 19 Feb. 2025, news.microsoft.com/source/features/innovation/microsofts-majorana-1-chip-carves-new-path-for-quantum-computing/. 

    Sekhon, Gianetan Singh. “Microsoft Majorana 1 vs Google Willow.” Medium, Medium, 25 Feb. 2025, medium.com/@gianetan/microsoft-majorana-1-vs-google-willow-0c000c098007. 

    “Gemini 2.0 Pro.” Google DeepMind, deepmind.google/technologies/gemini/pro/. Accessed 4 Mar. 2025. 

    Michelle Moore, PhD. “Top Cybersecurity Threats [2025].” University of San Diego Online Degrees, 23 Jan. 2025, onlinedegrees.sandiego.edu/top-cyber-security-threats/. 

  • How AI is Changing Biology: Genomics and Medicine

    Artificial Intelligence (AI) is transforming almost every single aspect of our lives, and biology is no exception. Recently, AI has played a major role in discoveries regarding genomics (study of genes) and personalized treatments and medications for patients. These advancements are altering how doctors are treating diseases, and changing our understanding of DNA.

    AI in Genomics

    The human genome is very complex, and sequencing it creates large amounts of data. However, with the help of AI, the process is sped up. Artificial intelligence’s ability to process large amount of data quickly, is assisting scientists in sorting this data and collecting information.

    Machine learning, a type of AI, is probably the most useful tool in medicine, because it has the ability to analyze gene sequences and find patterns that would normally go unnoticed. For example, AI is being used for looking at gene mutations to predict how it could lead to diseases like cancer or heart disease. By identifying these genetic markers early-on, AI can allow doctors diagnose patients earlier, and help scientists discover ways to treat or even prevent these diseases.

    AI is drastically speeding up research and making it easier to understand the complexity that is genetics, opening doors to major medical breakthroughs.

    Personalized Medicine

    Medicine is personalized to make sure treatments align with everyone’s unique genetic makeup, rather than using generic treatments for everyone. This is where AI is making a big difference. By looking at patient’s genetic information and medical history, AI is able to help doctors decide which treatment works best for an individual.

    For example, if someone has cancer, AI can help doctors choose the best chemotherapy drugs based on that person’s unique genetic mutations, something we were unable to do before. AI is also helping scientists develop new tests and treatments, customized for individual patients, which can lead to better outcomes and fewer side effects.

    Ultimately, AI is helping doctors get to know each patient’s DNA and create more personalized healthcare at an unprecedented rate. It’s a major leap forward compared to the old “one-size-fits-all” treatments.

    Challenges and Ethics

    Although AI is doing amazing things in biology, it is not all smooth sailing. There are a few challenges and ethical concerns that must be addressed. For one, the privacy regarding genetic data is a major concern. If AI is analyzing personal genetic information, how do we make sure that this data is kept safe from hackers or misuse?

    Additionally, there are big ethical questions around the extent as to how AI should be used in genetics. For example, how far should we go when it comes to editing genes or predicting someone’s future health? Should we even be allowed to change someone’s genes before they are born? These are all questions scientists and ethicists are trying to figure out.

    Even with these challenges, the potential for AI is huge, especially in biology. It’s already making an impact, and it will definitely continue to change the future of medicine.

    AI is the Future of Medicine

    AI is not just a cool futuristic idea—it’s already changing the way we study genetics and treat diseases. By helping scientists unlock the mysteries of our DNA and provide more personalized medicine and treatments, AI is making healthcare more effective than ever. As technology advances and more breakthroughs are made, we can expect AI to play an even bigger role in healthcare, ultimately leading to a future where treatments are better tailored to each individual.

    Resources Used:

    Vilhekar, Rohit S, and Alka Rawekar. “Artificial Intelligence in Genetics.” Cureus vol. 16,1 e52035. 10 Jan. 2024, doi:10.7759/cureus.52035

    Costa, Katrina. “Ai and Genome Engineering: New Directions in Biology.” Wellcome Sanger Institute Blog, 18 Dec. 2024, sangerinstitute.blog/2024/10/24/ai-and-genome-engineering-new-directions-in-biology/. 

    Johnson, Kevin B, et al. “Precision Medicine, AI, and the Future of Personalized Health Care.” Clinical and Translational Science, U.S. National Library of Medicine, Jan. 2021, pmc.ncbi.nlm.nih.gov/articles/PMC7877825/#:~:text=Precision%20medicine%20methods%20identify%20phenotypes,decision%20making%20through%20augmented%20intelligence. 

    Farhud, Dariush D, and Shaghayegh Zokaei. “Ethical Issues of Artificial Intelligence in Medicine and Healthcare.” Iranian Journal of Public Health, U.S. National Library of Medicine, Nov. 2021, pmc.ncbi.nlm.nih.gov/articles/PMC8826344/. 

  • DeepSeek R1

    Recently, I’ve successfully been able to download DeepSeek R1, an AI-powered tool, on my computer using llama.cpp. DeepSeek has been making major advancements in the world of search and language models. Installing it on my computer came with a few bumps, however with this post, you’ll be able to easily download it on your device. Since downloading it, I’ve been able to experiment with its various tools. At the end of the day, it’s interesting to see how artificial intelligence is growing, and I’m excited to explore this model more.

    Steps to Download DeepSeek R1 on Your MacBook

    1. Install the Needed Packages
      • Open Terminal: cmd & space, search Terminal, press Enter
      • Install needed dependencies
        • brew install cmake wget
    2. Clone and Compile llama.cpp
    3. Download DeepSeek R1 Model
      • Create a folder for the Hugging Face model:
        • mkdir -p ~/Documents/workspace/huggingface/models
        • cd ~/Documents/workspace/huggingface
      • Install huggingface_hub:
        • python3 -m venv venv
        • source venv/bin/activate
        • pip install huggingface_hub
      • Download the model:
        • huggingface-cli download bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF –include DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf –local-dir ./models
      • Verify that the model is properly downloaded:
        • ls models
    4. Run the DeepSeek R1 Model With llama.cpp
      • Navigate to llama.cpp build directory:
        • cd ~/Documents/workspace/llama.cpp/build
      • Run the model:
        • bin/llama-cli -m ~/Documents/workspace/huggingface/models/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf \ -ngl 100 -c 16384 -t 10 -n -2 -cnv

    Possible Errors:

    • If bin/llama-cli is missing, rebuild llama.cpp:
      • rm -rf build
      • cmake -B build
      • cmake –build build –config Release

    Terminal Commands:

    • mkdir workspace
      • mkdir = “make directory” – creates a new folder called workspace
    • cd workspace
      • cd = “change directory” – moved you inside the workspace folder so you can work on it
    • mv llama.cpp/ ~/Documents/workspace/
      • mv = “move” – moves llama.cpp folder to ~/Documents/workspace/
      • ~ = home directory
    • python3 -m venv path/to/venv
      • python3 – runs Python
      • -m – telling Python to run a module (venv in this instance)
      • venv – virtual environment at the location “path/to/venv”
        • replace “path/to/venv” with actual desired folder
    • source ./bin/activate
      • activates virtual environment so the installed packages don’t affect your system wide installation of Python
    • python3 -m pip install huggingface_hub
      • pip – manages Python packages and installs huggingface_hub library inside venv
    • huggingface-cli
      • runs Hugging Face to check if the installation was successful

    With the help of this post, hopefully you were able to successfully download and set up DeepSeek R1!