Skip to content

Instantly share code, notes, and snippets.

View thecaffeinedev's full-sized avatar
💻
Building Stuff

Prabhat Kumar Sahu thecaffeinedev

💻
Building Stuff
View GitHub Profile
@thecaffeinedev
thecaffeinedev / docker-compose.yml
Last active October 16, 2022 15:27
Kafka, Zookeeper and Kafka Manager - Docker Compose M1 Mac
version: '3.1'
services:
zookeeper:
platform: linux/amd64
container_name: zookeeper
image: zookeeper:3.4
restart: on-failure
volumes:
- "./zookeeper/data:/data"
@thecaffeinedev
thecaffeinedev / custom_yolov5s_blog.yaml
Created January 1, 2021 18:26
YOLO-V5 Config file for my blog
# parameters
nc: 7 # number of classes # CHANGED HERE
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
# anchors
anchors:
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32
@thecaffeinedev
thecaffeinedev / snippet_django_todo.html
Last active May 7, 2020 16:30
Code Snippet for django todo app tutorial
<h1>SignUp</h1>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Sign Up</button>
</form>
@thecaffeinedev
thecaffeinedev / requirements.txt
Last active January 6, 2020 08:19
Data Science Dependencies
absl-py==0.8.1
astor==0.8.0
certifi==2019.11.28
chardet==3.0.4
cogapp==3.0.0
Cython
decorator==4.4.1
defusedxml==0.6.0
gast==0.3.2
google-pasta==0.1.8
@thecaffeinedev
thecaffeinedev / remove_imagesnot_opening.py
Created December 28, 2019 10:55
Remove Images Which can't be opened fastai
for c in classes:
print(c)
verify_images(path/c, delete=True, max_size=500)
@thecaffeinedev
thecaffeinedev / download_image_urls.js
Last active January 24, 2022 02:45
Download Image URLs in a file Google Images
urls = Array.from(document.querySelectorAll('.rg_di .rg_meta')).map(el=>JSON.parse(el.textContent).ou);
window.open('data:text/csv;charset=utf-8,' + escape(urls.join('\n')));
@thecaffeinedev
thecaffeinedev / train_test.py
Created November 21, 2019 12:04
YoloV3 Custom model
import glob, os
# change the path of your images folder
dataset_path = '/home/thecaffeinedev/yolov3/training/images'
# Percentage of images to be used for the test set
percentage_test = 30;
# Create and/or truncate train.txt and test.txt
file_train = open('train.txt', 'w')
import numpy as np
def nonlin(x,deriv=False):
if(deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))
X = np.array([[0,0,1],
[0,1,1],
# Here, about 1.2 MB of data produced a pickle of about 120MB Of data 100 times
# training might take a lot of time on bigger data sets
# saving the model as you train it helps here
import tensorflow as tf
from TF_own_data_model import create_feature_sets_and_labels
import numpy as np
# can load the data from the pickle
# or you could just write it down
from numpy import exp, array, random, dot
class NeuralNetwork():
def __init__(self):
# Seed the random number generator, so it generates the same numbers
# every time the program runs.
random.seed(1)
# We model a single neuron, with 3 input connections and 1 output connection.