Skip to content

Instantly share code, notes, and snippets.

@tarun-ssharma
tarun-ssharma / calculate_mean_ap.py
Created February 21, 2022 15:42 — forked from sadjadasghari/calculate_mean_ap.py
Calculate mean Average Precision (mAP) for a set of ground truth and predicted bounding boxes for a set of images.
"""
author: Timothy C. Arlen
date: 28 Feb 2018
revised by: Sadjad Asghari Esfeden
date: 10 Sep 2018
Calculate Mean Average Precision (mAP) for a set of bounding boxes corresponding to specific
image Ids. Usage:
@tarun-ssharma
tarun-ssharma / quantized-inference-example.py
Created March 8, 2022 12:21 — forked from ShawnHymel/quantized-inference-example.py
TensorFlow Lite (TFLite) Python Inference Example with Quantization
# TFLite quantized inference example
#
# Based on:
# https://www.tensorflow.org/lite/performance/post_training_integer_quant
# https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/Tensor.QuantizationParams
import numpy as np
import tensorflow as tf
# Location of tflite model file (float32 or int8 quantized)
@tarun-ssharma
tarun-ssharma / yolov4.py
Created March 8, 2022 12:21 — forked from YashasSamaga/yolov4.py
YOLOv4 on OpenCV DNN
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()]
@tarun-ssharma
tarun-ssharma / detection_PC.py
Created April 22, 2022 02:40 — forked from iwatake2222/detection_PC.py
Object detection using MobileNet SSD with tensorflow lite (with and without Edge TPU)
# -*- coding: utf-8 -*-
import cv2
import tensorflow as tf
import numpy as np
# https://www.tensorflow.org/lite/guide/hosted_models
# http://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip
def detect_from_camera():
@tarun-ssharma
tarun-ssharma / convert_tflite_rep_data_int8.md
Last active April 22, 2022 02:44 — forked from dansitu/convert.py
Convert to tflite with randomly picked representative dataset
model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(128, activation='relu'),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
@tarun-ssharma
tarun-ssharma / ubuntu1804cuda10.sh
Created May 9, 2022 06:19 — forked from fo40225/ubuntu1804cuda10.sh
install cuda 10 on ubuntu 18.04
# echo "blacklist nouveau" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
# echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf > /dev/null
# sudo update-initramfs -u
sudo apt update
sudo apt -y install build-essential
sudo apt update
sudo apt -y install linux-headers-$(uname -r)

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@tarun-ssharma
tarun-ssharma / delete_git_submodule.md
Created September 14, 2023 19:48 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@tarun-ssharma
tarun-ssharma / gist:d3727d0d8d11d0be448eec2f7780c5b4
Created September 25, 2023 01:46 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@tarun-ssharma
tarun-ssharma / work-with-multiple-github-accounts.md
Created January 11, 2024 04:42 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent