This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple, hacked-up image similarity search using Tensorflow + the inception | |
CNN as feature extractor and ANNoy for nearest neighbor search. | |
Requires Tensorflow and ANNoy. | |
Based on gist code under | |
https://gist.github.com/david90/e98e1c41a0ebc580e5a9ce25ff6a972d | |
""" | |
from annoy import AnnoyIndex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. First of all of course get Manjaro: | |
https://manjaro.org/get-manjaro/ | |
# I recommend using Etcher to copy the image to your USB: | |
https://etcher.io/ | |
# 2. Before installing make sure: | |
# - Secure boot is disabled in BIOS | |
# - Your SSD, HDD or NVME drive is set to AHCI instead of RAID | |
# - Fastboot should be on Auto or minimal, but this shouldn't matter to much |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Euclidean distance. | |
def euc_dist(pt1,pt2): | |
return math.sqrt((pt2[0]-pt1[0])*(pt2[0]-pt1[0])+(pt2[1]-pt1[1])*(pt2[1]-pt1[1])) | |
def _c(ca,i,j,P,Q): | |
if ca[i,j] > -1: | |
return ca[i,j] | |
elif i == 0 and j == 0: | |
ca[i,j] = euc_dist(P[0],Q[0]) | |
elif i > 0 and j == 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |