Skip to content

Instantly share code, notes, and snippets.

View prajwalsingh's full-sized avatar

Prajwal Singh prajwalsingh

View GitHub Profile
@prajwalsingh
prajwalsingh / multipos.py
Last active September 7, 2023 15:55
Multi-Positive Contrastive Loss
# f: encoder: backbone + proj mlp
# tau: temperature
# minibatch x: [n, m, 3, h, w]
# n captions, m images per caption
# As per paper:
# n*m = 8192, and m=6 then n=1366
def H(p, q): # cross-entropy
return - (p * log(q)).sum(1).mean()
@prajwalsingh
prajwalsingh / iris.csv
Last active October 12, 2019 10:05
Logistic Regression From Scratch
sepal_length sepal_width petal_length petal_width species
5.1 3.5 1.4 0.2 0
4.9 3 1.4 0.2 0
4.7 3.2 1.3 0.2 0
4.6 3.1 1.5 0.2 0
5 3.6 1.4 0.2 0
5.4 3.9 1.7 0.4 0
4.6 3.4 1.4 0.3 0
5 3.4 1.5 0.2 0
4.4 2.9 1.4 0.2 0
@prajwalsingh
prajwalsingh / MaskingBeardOnMusk.py
Created July 31, 2019 17:36
Opencv Mini Project
import cv2
import numpy as np
firstImage = cv2.imread('data/images/musk.jpg',1)
secondImage = cv2.imread('data/images/beard.png',-1)
secondImageResize = cv2.resize(secondImage,(300,200),interpolation=cv2.INTER_LINEAR)
alphaImageMask = secondImageResize[:,:,3]
7f45 4c46 0201 0100 0000 0000 0000 0000
0100 3e00 0100 0000 0000 0000 0000 0000
0000 0000 0000 0000 d002 0000 0000 0000
0000 0000 4000 0000 0000 4000 0d00 0c00
5548 89e5 488d 3d00 0000 00b8 0000 0000
e800 0000 00b8 0000 0000 5dc3 4865 6c6c
6f20 576f 726c 6400 0047 4343 3a20 2855
6275 6e74 7520 372e 332e 302d 3237 7562
756e 7475 317e 3138 2e30 3429 2037 2e33
2e30 0000 0000 0000 1400 0000 0000 0000
.file "hello.c"
.text
.section .rodata
.LC0:
.string "Hello World"
.text
.globl main
.type main, @function
main:
.LFB0:
# 1 "hello.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "hello.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 27 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4
#include<stdio.h>
int main(){
printf("Hello World");
return 0;
}
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
@prajwalsingh
prajwalsingh / pythonNotes.html
Created June 16, 2017 13:30
Final Python Html
<Html>
<Head>
<Title>Pyhton Notes</Title>
</Head>
<Body>
<H3 style="color:WHITE;background: TOMATO; text-align: center;">FILES</H3>
<div style="width:auto; height:auto; background: rgba(50, 20, 158, 0.8); color:WHITE; box-shadow: 0px 0px 15px BLACK;">
<pre style="font-weight: bold; font-size: 15px;">
@prajwalsingh
prajwalsingh / pythonNotes.html
Last active May 10, 2017 20:31
Python Notes
<Html>
<Head>
<Title>Pyhton Notes</Title>
</Head>
<Body>
<H3 style="color:WHITE;background: TOMATO; text-align: center;">FILES</H3>
<div style="width:auto; height:auto; background: rgba(50, 20, 158, 0.8); color:WHITE; box-shadow: 0px 0px 15px BLACK;">
<pre style="font-weight: bold; font-size: 15px;">