@KalPragya: Hello, World!
Welcome to KalPragya - Your source for insights and advancements in Machine Learning, Artificial Intelligence, and Neuroscience.
Table of contents
No headings in the article.
Hello, world.
I have been meaning to start my blog for quite some time and have finally taken that first step. So here I am with my fancy-named blog. The name "Kalpragya" is derived from the Sanskrit words "Kalpa (कल्प)," meaning artificial, and "Pragya (प्रज्ञ)," meaning intelligence. So literally, artificial intelligence.
By the way, I forgot to introduce myself. My name's Aarush Mohit Mittal, and I finished my Ph.D. in Computational Neuroscience last year. I am also an ML enthusiast, having worked on some fascinating projects in recommendation systems since starting my journey as an ML Product Manager. So in this blog, you will find my hot takes on how the world of neuroscience and machine learning collide and grow together. The goal is to share my passion for these cutting-edge fields and hopefully inspire you to build your own models.
Let's start by doing something fun in Python. Here's a small function that converts a black & white logo to asterisks:
def convertImageToAsterisks(fileName, cols, rows):
'''
Converts a black & white image defined by fileName to an array of size rows * cols,
where the black pixels are set to asterisks (*) and white pixels to a space.
Inspired by the image to ascii image function by Mahesh Venkitachalam (https://github.com/electronut/pp/blob/master/ascii/ascii.py)
'''
img = Image.open(fileName).convert('L')
# calculate the height and width of each tile
width = img.size[0] / cols
height = img.size[1] / rows
astImg = []
for r in range(rows):
top = int(r * height)
bottom = int((r + 1) * height)
# correct bottom coordinate for last row tiles
if r == rows - 1:
bottom = img.size[1]
# append an empty string
astImg.append("")
for c in range(cols):
# crop image to tile
left = int(c * width)
right = int((c + 1) * width)
# correct right coordinate for last column tiles
if c == cols - 1:
right = img.size[0]
# crop image to extract tile
subImg = img.crop((left, top, right, bottom))
# get average value of the pixels for the extracted tile
im = np.array(subImg)
avgVal = int(np.average(im.reshape(im.shape[0] * im.shape[1])))
# if average pixel value is > 0.5, put an asterisk, else a space
if avgVal > 0.5:
astImg[r] += " "
else:
astImg[r] += "*"
return astImg
Here's the Kalpragya logo (I hope you like the logo) in all its asterisk-ized (I know it's not a word) glory generated using the above function:
****************************************
****************************************
******************* ********** ** *****
*** ***
*** ***
*** ***
*** ***
*** ***
*** *** ** ***
**** *** **** ** ***
******* ** ********* ***
*** *** ** ****
*** ****** ****
** **** ***
** **** ***
** **** ***
** ** ***
** *** ***
* *** ****
*** **** *****
*** * ** ******
** ** *** ** ***
*** *** * * ***
*** * *** *** ***
****** *** ***
**** *** ***
*** ***
*** ***
*** ***
** ***
* ***
* ***
***
I'm excited to share my insights with you, and I can't wait to see where our AI and machine-learning journey will take us. So stay tuned for more exciting updates and articles, and be sure to hop aboard the Kalpragya ship!