Skip to content

Instantly share code, notes, and snippets.

View quickgrid's full-sized avatar

Asif Ahmed quickgrid

View GitHub Profile
@quickgrid
quickgrid / yolov4.py
Created August 9, 2021 15:07 — forked from YashasSamaga/yolov4.py
CUDA4DNN YOLOv4 Discussion
import cv2
import time
CONFIDENCE_THRESHOLD = 0.2
NMS_THRESHOLD = 0.4
COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, 0), (255, 0, 0)]
class_names = []
with open("classes.txt", "r") as f:
class_names = [cname.strip() for cname in f.readlines()]
#!/usr/bin/env python3
'''
always getting the most recent frame of a camera
================================================
Usage:
------
freshest_camera_frame.py

Convert PascalVOC Annotations to YOLO

This script reads PascalVOC xml files, and converts them to YOLO txt files.

Note: This script was written and tested on Ubuntu. YMMV on other OS's.

Disclaimer: This code is a modified version of Joseph Redmon's voc_label.py

Instructions:

  1. Place the convert_voc_to_yolo.py file into your data folder.
@quickgrid
quickgrid / PyTorchImageClassificaitonGPU.py
Created December 30, 2019 22:24
CIFAR10 image classification using CNN with pytorch gpu. This is a simple network and accuracy reaches to 77% on 10 epochs.
import torch
torch.manual_seed(0)
import numpy as np
np.random.seed(0)
import random
random.seed(0)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
#torch.cudnn.benchmark = True
@quickgrid
quickgrid / SuccessiveSum .cpp
Last active October 17, 2019 16:03
C++ Class Object Oriented Fast Successive Sum Generation
/*
* Site: quickgrid.blogspot.com
* Any suggestions for faster or better implementation is welcome.
* 17-10-2019 removed personal headers, now the code will work directly.
*/
#include<iostream>
using namespace std;
@quickgrid
quickgrid / python_pdf.py
Last active January 29, 2018 11:21
PyPDF2 pdf manipulating and writing example beginner working sample.
# This is a PyPDF2 example found in sample_code directory.
# I removed some parts which may cause problems for beginners.
# Also fixed code to work with python 3+.
from PyPDF2 import PdfFileWriter, PdfFileReader
output = PdfFileWriter()
input1 = PdfFileReader(open("sample.pdf", "rb"))
# print how many pages input1 has:
@quickgrid
quickgrid / BitBasedSortingAlgorithmSetBitsetOLD.cpp
Created January 15, 2017 00:20
This is a bit based sorting algorithm for integer and float numbers. This follows counting sort principle. This one behaves as a set and uses bitset. This is the old version of BitBasedSortingAlgorithm.cpp
/**
* By: Asif Ahmed
* TODO: Instead of set increment val_count to reflect duplicate values.
*/
#include<bits/stdc++.h>
using namespace std;
@quickgrid
quickgrid / BitBasedSortingAlgorithm.cpp
Created January 15, 2017 00:19
This is a bit based sorting algorithm for integer and float numbers. This follows counting sort principle.
/**
* By: Asif Ahmed
* TODO: Proposed optimization.
*/
#include<bits/stdc++.h>
using namespace std;
@quickgrid
quickgrid / LinearRegressionGradientDescentCppImplementation.cpp
Last active December 21, 2016 15:36
Simple c++ program to fit a line though given points in 2-space. This implementation is made following the machine learning course on coursera by Andrew NG, linear regression gradient descent. It uses tolerance level to terminate execution.
/**
* Author: Asif Ahmed
* Site: https://quickgrid.blogspot.com
* Problem: Linear Regression gradient descent curve fitting though points in 2-space.
* Details: Please remove windows.h header if any trouble with compilation.
*/
#include<bits/stdc++.h>
#include<windows.h>
#define M 5
@quickgrid
quickgrid / uva-821-Page-Hopping-Floyd-Warshall-Stl-Set.cpp
Last active December 13, 2016 16:03
C++ Solution UVA 821 - Page Hopping Floyd Warshall Simulation Explanation and stl set https://quickgrid.blogspot.com
/**
* Author: Asif Ahmed
* Site: https://quickgrid.blogspot.com
* Problem: UVA 821 - Page Hopping
* Technique: Floyd warshall algorithm unweighted directed graph
* C++ stl set
*/
#include<bits/stdc++.h>
using namespace std;