Tag: deep learning

  • September Update: Portfolio Sites, AI Reboot & Alternate Reality

    September Update: Portfolio Sites, AI Reboot & Alternate Reality

    Welcome back to Discordant Harmony! It’s been a few weeks since the last update, but I’m now back with the September update on how various projects have been going. In this blog, I’ll discuss a new alternate reality game/narrative I’m working on, some new video editing projects, and new AI/machine learning endeavors including the Painting Classifier AI Project and Quarto sites.

    AI, Machine Learning, and Portfolio Sites

    The homepage of my new Quarto portfolio site for active model experimentation

    First up, I suppose, will be my various attempts at restarting the machine learning projects I’ve been working on. They have been sitting around for a couple of months now, ever since fast.ai broke something in their code and prevented users from building anything back at the end of June. Those issues have now been fixed, and I’ve moved away from trying to use the deprecated fastpages anyway to host live versions of my models. Instead, I discovered the much better successor to fast.ai called Quarto, which allows you to host Jupyter Notebooks, blogs, and model embeds through GitHub Pages.

    This is what I’ve been working on over the past week. I now have a live, working Quarto portfolio with the latest Ashryver Painting Classifier (via a HuggingFace embed) and, finally, the CIFAR-10 Image Classification Model I trained last year, during the inset event. Additionally, I’ve put up the QuickDraw Shape Recognition Model that I recently refurbished from August 2025, and it worked surprisingly well with the Gradio Sketchpad integration on HuggingFace. This is something that I’ve been working towards for quite a while–back in June, I stated that I was “really trying to move away from models that exist only within a Visual Studio Code window and require extensive amounts of effort on the part of the user to get it working on their own machine.” Well, that move has finally been made.

    As of Thursday, I now have a working blog set up on the Quarto site, where I can add posts containing notebooks, code snippets, and anything else that allows me to do detailed data storytelling and visual analysis. The Quarto interface is a little bit clunky behind the scenes–you have to deal with both a .qmd page and an .html page and update both whenever you want to insert a blog. However, it’s much better than alternatives like Netlify or the deprecated fastpages if you want to showcase personal models (not production-ready content) and post blogs containing Jupyter Notebooks.

    At the moment, I have no plans to host any of these models on large, production-ready sites like Vercel or ChatCode. This may come later if I find that I need more hosting space or interaction with users, but for now Quarto works perfectly fine for displaying these projects so people can actually use them. I’ve heard that Quarto is highly flexible when it comes to inserting runnable notebooks, which is something that’s pretty important for the kind of work I’m doing right now. And the process for uploading the models to Quarto really wasn’t so bad: all I had to do was get the .h5 or .keras model files, upload them first to a HuggingFace/Gradio space, and then link that space as an embed to the Quarto site.

    Now that the Quarto site is pretty much done for now, I’ll be looking at (perhaps) designing a custom interface for the HuggingFace embeds, using HTML and JavaScript, so that they can look a little bit better. There’s nothing wrong with them now; however, for the future, it may help if I have even more of a flexible interface. Then, it’ll be straight into Unit 3 of the Practical Deep Learning course. There isn’t any need to continue interating on the painting classifier right now; it works perfectly fine and it’s already been three months since I started the second unit.

    I noticed that fast.ai’s Practical Deep Learning for Coders course is woefully outdated in several key areas; notebooks do not work, workspaces are deprecated, and packages are broken entirely. If this becomes prohibitive as I continue to work through the course, I may switch away from this and personally explore some other ML topics. At the same time, I might start a new Intro to Machine Learning course on MIT’s Open Learning Library; most of the content will be a review but it’s good to make sure I’m not forgetting the fundamentals, anyway.

    The Alternate Reality Project

    “Olivia’s relationship with her brother can best be described as intimate, careful, and at times, playful…she very rarely becomes outwardly upset with other people, [but] will sometimes rant about frustrations to her brother behind closed doors.”

    — the Episodic Alternate Reality Narrative, volume 01

    I’m guessing that you’re wholly gobsmacked by the above quote. After such a serious, concrete discussion about machine learning models and AI courses, we have . . . what?! A paragraph that reads like it’s from some kind of elaborate personal databse file? No, fear not. This is simply one of the opening sentences of my latest undertaking, the episodic Alternative Reality Narrative, Volume 01, or e-ARN 01.

    What is it, exactly? Consider it a space where I’m experimenting what life woud be like now (and in recent times) if things had gone very differently many years in the past. In the narrative, I’m writing prose, third-person descriptions, or brutally-honest observations on life in what I like to call the Alternate/Augmented Universe. Every section and every account in the narrative is designed to sound as real as possible, although it of course is only fiction here in the Prime Universe. Detailed narratives are engineered to read like lengthy Ready Writing prompt responses, except without a clear direction and more focused on the presence of our new alternate-reality character.

    And, because this is a bit more than just a narrative, I have created additional artifacts (such as online, for example) that complement the project. Most notable is the Fuzzy Thoughts AoPS blog, which I recently created alongside my prime-universe random ramblings blog as the official writing site of our alternate character. As our character (codenamed claudaroo in the alternate universe) is extremely busy, posts only happen once or twice a week. However, having a dedicated alternate-universe blog allows me to more precisely craft a new character, showcsae their interests, and engage in fictional back-and-forth conversations with them. (There is no other person on the other side of the computer screen, of course. I’m merely playing both sides of the field; skronkmonster is wholly responsible for the creation of the blog).

    My plan is to focus on the handwritten narrative format (yes, handwritten) and progress through several volumes of the e-ARN 01 to fully develop this character. Why handwritten, you ask? Simply because I feel that I think more creatively while in bed, poised over a notebook and determined to uncover what, exactly, life would be like in this very different Alternate Universe. It’s sort of like superimposing a brand-new individual on top of your everyday adventures, which can be both enlightening, fascinating, and frightening all at once. Shown below is the cover page of volume one, which is currently in progress and set to take up about twenty-one pages. (This all appears in the official SIA Time Capsule Notebook).

    The title says it all (no inferences required). I will, of course, be scanning all twenty-one pages into a secure location on the DiskStation and the Google Drive once volume one is complete.

    Stay tuned for further information on this up-and-coming alternate reality project. It’s one of my most unusual undertakings yet, and I’m excited to see where it goes.

    Other Projects

    I’m sure there are a whole lot of other things that I’m missing, but one thing I can think of right now is Flames of Rebellion, Book 4. This project has been sort of put on hold, as the AI stuff has taken the center stage and several new submissions and competiton applications have been taking place. That’s not to mention the Labor Day Animal Concert coming up next week, and several new jazz-related musical compositions that actually tie in closely with the alternate reality narrative (yes, everything seems to come back to that lately). So I’m letting the machine learning, the BeamNG.drive video editing, and the various short stories I’m working on take the stage, because Flames of Rebellion doesn’t really have too much of a deadline. (I’d like to try to finish the series before Int-Offshore 2027, but I think that’s pretty unlikely at this point).

    I’ve now been a member of the BeamNG Roleplay subreddit for almost four months, which is pretty hard to believe. I’ve not been as active on there lately, but after this weekend, I might have some new posts–and short videos to upload on the main BeamNG subreddit. I’ve been getting into the cutting-up side of BeamNG, and I’ve flagged a new map mod and traffic mod to download for more immersive cutting-up sessions. Bonus points if I can get the insane in-simulation motion blur to cooperate, because that really improves the realism of the whole environment.

    Well, that’ll be all for now. Don’t forget to check out the updated AI & Machine Learning Projects page, which now has new links and images. Until then, I’ll see what happens with all these endeavors!

  • Ashryver V1 Painting Classifier: Release Summary

    Ashryver V1 Painting Classifier: Release Summary

    Today, I finally finished setting up the Ashryver V1 Painting Classifier, my latest interactive web-based model, and placed a live embed on the AI, ML, and Web Projects page. You can now interact with the model right from your browser, and upload any painting you choose for the model to make predictions. Although the embed is a little small, and the formatting is still on the uneven side due to WordPress’s lack of flexibility, I hope to have these issues sorted out soon. Besides, my ultimate plan (perhaps once the final, non-prototype Ashryver V2 model comes out) is to place an active HuggingFace API instance of the model on one of my websites. I’ll have to wait until HuggingFace and Gradio sort out a CORS issue first, though, as there have been known issues across all platforms for the past few weeks.

    In this post, I’ll provide a brief summary of the training process, the overall model performance, and my future goals now that this project is “finished”.

    The Training Process

    I started working on the Ashryver V1 model about a week ago. I used the fast.ai foundational framework for this project, moving away from the clunky and cumbersome Tensorflow libraries I had been familiar with before. fast.ai is just an upper layer of Pytorch, which is the latest and most efficient machine learning library. I was blown away by how easy it is to instantly create and train a deep learning model; all it takes is just a few different code cells and some DataBlocks.

    As a brief reminder, this Ashryver V1 model is a painting classifier trained on images of 20 different Impressionistic and modern artists; I aimed for about 300-400 images per artist, yielding a total dataset of about 2,700 images (about 500 of which were split off for validation). Although this is a relatively modest dataset size, it ended up doing the job very well. I did have to go through several training runs to get the accuracy above its initial poor score of 0.60, but things turned out well in the end.

    At first I was using the resnet34 model, which was rumored to be exceptionally good at classifying paintings. This is one of PyTorch’s pretrained models, and it’s called resnet34 because it has 34 layers in its convolutional neural network. This worked out okay, but generally you want to be achieving higher than 0.60 validation accuracy for a classification model. So I decided to switch to the resnet50 model, which prefers an image size of 224 x 224 pixels and has 50 layers in its CNN. This model performed substantially better, first achieving an accuracy of 0.77 on the initial 1800-image dataset, and then 0.89 on the final 2700-image dataset.

    Once you have your data in the artist folders, this is all you need to do to train your model -- just two simple code cells.
    
    # Create the Datablock
    dls = DataBlock(
        blocks=(ImageBlock, CategoryBlock), 
        get_items=get_image_files, 
        splitter=RandomSplitter(valid_pct=0.2, seed=42), # split 20% of the data off for validation
        get_y=parent_label,
        item_tfms=[Resize(448, method='squish')]
    ).dataloaders(painting_data_updated, bs=32)
    
    dls.show_batch(max_n=20) # show a sample of 20 images that the model will be trained upon
    
    # Train the resnet50 model
    learn = vision_learner(dls, resnet50, metrics=error_rate)
    learn.fine_tune(4) # train for 4 epochs
    

    The Production Process

    Once I finished training the model and was satisfied with the result, I moved onto the production process. In the previous blog post, I touched on the difficulties I was having with HuggingFace in setting up a space for the model; I managed to resolve these issues a few days ago and get moving. The Ashryver V1 model (and any successive models) are running in a HuggingFace space, which I’ve set up and named ‘erilea-models’ to embody the fictional continent of Erilea. This space behaves somewhat like a GitHub repository, which you can clone down to your computer to add code and add models that can be represented using HuggingFace’s UI. All I had to do with this repository was drop in my pre-trained model in the form of a PKL file, and then call that file to make predictions using a simple notebook. That notebook then launched a Gradio interface (essentially what creates the graphical UI you see on the space itself) that allowed the model to make live predictions.

    This way, you don’t have to clone down the entire repository and install a bunch of insane packages to play around with the model. You can just go to the HuggingFace space (which I’ve made public), upload your own images, and have it make predictions. There’s actually even more I could do with this model, like using the Gradio API to place it on one of my own websites and use some custom JavaScript to make it look a bit different. However, the current HuggingFace solution works perfectly fine for this V1 model; I may consider switching to a more advanced API solution for V2.

    Next Steps

    Speaking of V2, let’s take a final look at my next steps for the Ashryver model. I’d like to improve the model’s reliability on Matisse paintings; right now it continually misclassifies Matisse’s tape drawing The Bees. I’m not sure how to deal with this one, as it isn’t a “painting” in the traditional sense, but users might still want to predict with that image. There have also been some isolated issues with other artists, where incorrect predictions crop up every so often.

    For V2, my plan is to find some way to deal with the ridiculous watermarked images or those that contain overlaid text in the training process, as these really seem to be sabotaging the model. I also would like to add a bit more data if possible, maybe for certain artists only, so the model can get a more comprehensive view of what’s going on. I may also add some additional artist categories (although this is optional), and I would definitely like to add a “sister” model that is designed to recognize the artistic era or period of a painting, and use that model to make “backup predictions” of a painting’s era in addition to the artist, in case you give the model a painting that it’s not familiar with. These enhancements should make the Ashryver model much smarter overall as a painting classifier; once I get these improvements done, I should be ready to move onto Unit 3 of the fast.ai Practical Deep Learning course.

    Don’t forget to check out the model on HuggingFace, or go to the AI, ML & Web Projects page to play around with the widget. Stay tuned for more updates!

  • Deep Learning Debacle: Deploying the Ashryver V1 Model (Painting Classifier)

    Deep Learning Debacle: Deploying the Ashryver V1 Model (Painting Classifier)

    Today (and this entire week) has been quite the adventure when it comes to deep learning AI models. I finally got off the ground on my latest project, the Ashryver model (the easy-to-remember codename for the 20-artist painting classifier). After building it locally with Jupyter Notebooks and Kaggle, I advanced to the next unit in the fast.ai Practical Deep Learning course, and started attempting to deploy it on a HuggingFace/Gradio space…

    …and promptly entered into a world of calamity.

    Creating an account on HuggingFace and setting up a space was pretty easy. But that was just the tip of the iceberg, as you might imagine. After that I had to figure out a way to set up an API key, clone HuggingFace’s Github-adjacent-but-not-really-Github repository down to my computer, add my pickle files for the Ashryver model, and deal with all the humongous files and conflicts. This quickly spiraled into hell. First of all, the API keys kept getting “into a stuck state” when attempting to commit changes to HuggingFace; apparently HuggingFace had deprecated a core feature that allowed users to authenticate with their HuggingFace password back in 2023, and you now had to use your cryptic API key. So I was forced to generate the in-universe “aelin” API key and use that, which fortunately worked.

    However, that wasn’t the end of the troubles. I then encountered issues committing any changes at all to HuggingFace, due to binary file limitations and Git LFS complications. At this point I was engaging in a lengthy back-and-forth conversation with Google Gemini, trying to figure out the best course of action for what I was facing. Every time I tried to turn on LFS or add the files, pushing any staged files would just lead to more and more errors. Eventually I just gave up and followed two core pieces of ML management advice: never upload your .PKL files or dataset files to source control because they can be a target for malware and bloat your repo. For now, I’m just leaving them untracked on my laptop, and not committing them to HuggingFace. After all, the model will be able to run live; users shouldn’t need to poke around in the source code this time.

    Speaking of poking around in the source code and my future plans for the Ashryver architecture, let’s dig into those topics now…

    Future Plans, Links, and Naming Conventions

    The current state of the HuggingFace space, displaying all model files

    Click to view the current HuggingFace space, which is still very work-in-progress.

    You may have noticed the rather unconventional name of the space itself, erilea-models, and the interesting name for the painting-classifier model architecture, Ashryver. If you’ve really been poking around in the Files section of the HuggingFace space, you may have noticed references to an “Aelin” or “Sam Cortland”. If you’re really receptive, you may have made the proper neural network connections and surmised that these are characters from a fictional series.

    If so, congratulations. To make things more interesting, and detract from the tradition of naming repositories and models boring things “like Testing Area 1 and Deep Learning Architecture System Version 1”, I decided to spice things up and give this space and its models some creative names. These are not so much “original” as “easy-to-remember”, which makes it more convenient to key in GitHub commands when all your filenames and model names are simple names. I plan on naming each successive model I release after a different character, improving upon each one with clear version numbers.

    As for my plans at the moment, I intend to continue working on getting the Ashryver V1 model into production. When that’s done, you’ll be able to go directly to that HuggingFace space (linked above), upload your own paintings, and have the model instantly make predictions. Right now, although the model has consistently been getting 0.89 accuracy on test runs, it still makes the occasional error when it comes to Henri Matisse’s paintings and tape drawings. This is an issue I plan to correct in Ashryver V2, which is where I might also introduce more artist categories. For now, though, all my time is probably going to be spent on getting Ashryver V1 into production.

    What all this means is that users will no longer have to clone cumbersome GitHub repositories and figure out ways to get my code to work on their very different machine, which sounds like a recipe for disaster. I’m planning on uploading my past models into that same HuggingFace space as well, or maybe a different one to improve organization. I’ll at least put the CIFAR Image Classifier on there, and maybe even the QuickDraw model if I can get it to work. After that, I intend to work on some more computer vision models, deep learning projects, and put something even more substantive than Ashryver out on the web.

    I’ll probably put up links to my various HuggingFace spaces eventually on this website, and they will serve as the “showcase sites” or portfolio pieces for the various AI models. This is what I’ve been working up to for quite a while, and it’s good that I’ve finally started working on a way to get these models into production.

    Well, that’s all for now on the deep learning front. Stay tuned for more calamitous updates!