Skip to content

Instantly share code, notes, and snippets.

import numpy as np
dist1 = np.array([6.391326314769685e-05, 0.05027947947382927,\
0.10930796712636948, 0.24019761383533478, 0.30929023027420044,\
0.169674351811409, 0.07713371515274048, 0.036470066756010056,\
0.007540848571807146, 4.184951467323117e-05])
dist2 = np.array([0.1]*10)
# weighted mean
@vishal-kvn
vishal-kvn / python_setup_tools.py
Last active May 20, 2020 20:25
package_data is very helpful. The default behavior is to include only .py under site-packages
#!/usr/bin/env python
from setuptools import setup, find_packages
# https://svn.python.org/projects/sandbox/trunk/setuptools/setuptools.txt
# ls /Users/vkajjam/miniconda3/envs/feature_engineering/lib/python3.7/site-packages/
setup(
name="color profiler",
version="0.0.1",
description="color profiler app.",
@vishal-kvn
vishal-kvn / 3-IVFPQ.py
Created May 11, 2020 11:15
Similarity search with IVFPQ index using vector search and id search with reconstruction
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
d = 64 # dimension
nb = 100000 # database size
nq = 10000 # nb of queries
@vishal-kvn
vishal-kvn / gt_computation_sift1M.py
Last active May 3, 2020 14:11
FAISS: Recompute ground truth on SIFT1M and validate against existing ground truth results using faiss.IndexIDMap & `add_with_ids`
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python2
from __future__ import print_function
import os
import time
from concurrent.futures import ThreadPoolExecutor
import csv
import numpy as np
from functools import partial
import random
import threading
import time
filename = 'lock_writes.csv'
def thread_function(lock, id):
#!/bin/bash
# kernel-version:
echo "Kernel version: $(uname -r)"
# kernel-release:
echo "Kernel release: $(uname -v)"
# operating-system:
echo "Operationg System: $(uname -o)"
@vishal-kvn
vishal-kvn / tensorflow_stdout_step_loss.txt
Created May 5, 2019 13:13
No messages like 'INFO:tensorflow:global step .. loss...' while training model
# https://github.com/tensorflow/models/issues/5348#issuecomment-423634084
The model_train.py combined train.py and eval.py
in ole version and find that:
1 Add tf.logging.set_verbosity(tf.logging.INFO) after the import section of the model_main.py script. It will display a summary after every 100th step. Maybe model_train.py forget it officially.
2 As for the warning like WARNING:tensorflow:Ignoring ground truth with image id 283094706 since it was previously added, if you set anyone of the arg in --num_eval_steps=200 or the num_examples in .config file
eval_config: { num_examples: 200 max_evals: 10 }
larger than the numbers of your test images in you datasets. Then it will show the warning. So just set them as the test images num will be ok.
mkdir -p ~/catkin_ws/src
cd ~/catkin/src
catkin_init_workspace
cd ~/catkin
catkin_make
ls
cd ~/catkin_ws/src
$ git clone https://github.com/udacity/simple_arm_01.git simple_arm
cd ~/catkin
minikube version
minikube start
kubectl version
kubectl cluster-info
kubectl get nodes
# Deploying app example 1
kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080
kubectl get deployments
source 'http://rubygems.org'
gem 'rails', '3.0.10'
gem 'mysql2', '< 0.3'
gem 'paperclip'
gem 'rake'
# Use unicorn as the web server