Do you write legible, well indented code, with comments (jus cause you like it, or want to), or do you take time to make your code well-structured like it's a tutorial for yourself, or just because you enjoy writing software.

Do you write legible, well indented code, with comments (jus cause you like it, or want to), or do you take time to make your code well-structured like it's a tutorial for yourself, or just because you enjoy writing software.

I did the same thing, by writing a neural network from scratch (GitHub), people say it looks like coded by an LLM. well, maybe the main python file cause of lack of time (that too only matplotlib functions), but the NN class python file was somn which I wrote by following a playlist online, even with a few changes of my own. But its showing up as AI-written on many checking sites? why so?? if yes, does the NN python file really look AI-written? how do you write code? could you show me?

u/compugineer44 — 8 days ago

I implemented Tabular Q - Learning from scratch

Check out the GitHub repo. This is a from scratch implementation of Tabular, 1-step, Q - Learning, with the environment built from Pygame. The above GIF demonstrates the agent exploring/exploiting the environment (left) based on the epsilon value to maximize it's reward signal, and the Q - function (right) displaying what the agent thinks is the action per state that yields the highest reward for that state.

u/compugineer44 — 9 days ago

I wrote neural network optimized with ADAM from scratch, that is pedagogically better. Trained on MNIST to ~96% accuracy within 1000 iterations

GitHub

I tried to create a pedagogically better implementation of a neural network, focusing on the dimensionality of the layers of the neural network. It also serves as a project to learn the first principles of neural networks. The idea is that the dimensionality is adjusted so that it make intuitive sense better, atleast relative to NN diagrams teachers use while explaining the topic.

edit : the training seems slow in the GIF, but I think its because the overhead caused by matplotlib itself, and using windows screen recorder

edit : If you want to call this AI, atleast visit the GitHub repo once, the GIF you see is just a small matplotlib window, recorded using windows snipping tool, which already gave out low resolution, and then converted to GIF. I started coding by making my own 2D games back in my Middle school. So whatever i build i like to take some time to make it visually appealing, or data rich, that's why unfiltered and filtered accuracy and loss. If you still wanna call my work AI, I simply cant care, Take care

edit : the plt.pause call also checks in, thats technically matplotlib overhead. But i've noticed the snipping recorder induce heavy increase in delta-times, both in applicational rendering like unity and code executions, check it if you want. As far as the same "initial commit" in the repo files goes, i usually write my program in vs code and once the program is somewhat finished i create a repo and just dump/push my code there, only for a link in my resume and for reddit or instructables, that's why the same commit. Atleast with respect to this project, the maximum AI i used is Google AI mode search, that too only for consolidate data, like finding the right functions for matplotlib. As far as the NN implementation goes, I followed a online playlist on youtube by vizuara. Cheers!

u/compugineer44 — 9 days ago

A doubt about momentum in ADAM Optimizer and ~Vanilla

there are two main formulas that i know of for introducing momentum in the Optimizer of a neural network...

the first one:

weight_update = momentum_factor*prev_updates - learning_rate*gradients
weights += weight_update
prev_updates = weight_update

the second one:

weight_momentum = (beta*weight_momentum) + (1-beta)*gradients
'''which is later used in ADAM optimizer's updation formula'''

But, atleast according to me, only the first one feels intuitively like momentum, as the past weighs in to keep the gradients going even if it stalled, like its got kinetic energy. I don't know why but the second one feels like inertia really, atleast intuitively, as weight_momentum is initialized to 0 and gradually modified as the gradients change,you know, resisting external forces. I see that the second one is supposed to be a moving average of some kind. But I'm thinking this inertia intuition has something to do with how the equations are written, but what do i know! What do you think?

reddit.com
u/compugineer44 — 12 days ago

Finished the RTIOW book, in a little more than a weekend :)

Well, I've been juggling this along with a Unity-Dev internship, but in the end learning is all that matters, and I hope to do this for a job someday...

the above attached is an offline rendering with the renderer I've built

u/compugineer44 — 14 days ago
▲ 13 r/diyelectronics+1 crossposts

Requesting opinions/advice on connecting a camera (OV7670) to the Teensy 4.0 for a stereo camera setup

Hello there, I'm currently involved in a project that requires building a stereo system on an embedded scale. I did a bit of research and went with the OV7670 camera (non-FIFO model) and a Teensy 4.0 micro-controller.

I have started this project before I began my Bachelors degree, and still ongoing. Back then I did some experimentation and created a code-base to interface the OV7670 and the Teensy. I later converted it to a simple optical flow sensor as a little fun project (like a mouse). Published on GitHub, Instructables.

I have used SCCB (Serial Camera Control Bus) to set registers on the OV7670 for camera settings, and used nested for loops, interrupts and read camera signal pins to govern capture logic as per the data-sheet.

I need some feedback/advice for the next steps. Is this the effective approach to control the camera for max performance (so far i have got ~48 FPS at QVGA resolution setting) and solve through, to achieve a stereo camera setup. I am a beginner and am still learning. What improvements can I do to achieve stereo vision,i.e., two cameras and an IMU onboard, controlled by a Teensy 4.0

(The Instructables article details my findings in the process, please go through it for further context)

Thank you in advance.

u/compugineer44 — 22 days ago

I'm currently following RTIOW, where to get lambertian surfaces, you add a random unit vector to the surface normal. But instead of adding the random_unit_vector, i added a random_on_hemisphere vector (by passing the same normal), and got darker shadows (image1.jpg)

u/compugineer44 — 1 month ago