Skip to content

Instantly share code, notes, and snippets.

View haoshan98's full-sized avatar
🦊

Hao Shan haoshan98

🦊
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@haoshan98
haoshan98 / c3w2_assignment_5-shot-detector.ipynb
Last active February 15, 2021 16:30
C3W2_Assignment_5-shot-detector.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@haoshan98
haoshan98 / train.py
Created February 21, 2021 10:00
Decode Captcha Predictions Improvement
def remove_duplicates(x, seperator="§"):
if len(x) < 2:
return x
fin = ""
for j in x:
if fin == "":
fin = j
else:
if j == fin[-1] and fin[-1] is not seperator:
continue
@haoshan98
haoshan98 / to_unzip.sh
Created March 17, 2021 06:05
[utils] unzip recursively
#!/usr/bin/env bash
: ${1:?Please supply a file} # ${1} is the zip being fed to the script -- a little user-friendliness never went amiss
DIR="${1%.zip}" # this is where the current zip will be unzipped
mkdir -p "${DIR}" || exit 1 # might fail if it's a file already
unzip -n -d "${DIR}" "${1}" # unzip current zip to target directory
find "${DIR}" -type f -name '*.zip' -print0 | xargs -0 -n1 "${0}" # scan the target directory for more zips and recursively call this script (via ${0})
# 1. Make it executable
# chmod +x my_unzip.sh
@haoshan98
haoshan98 / adversarial_attack_mnist.ipynb
Last active April 3, 2021 14:51
Attack for specific target by train the perturbation tensors
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.