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
from pathlib import Path | |
import struct | |
lines = Path('calib_yolov4-int8-608.bin').read_text().splitlines() | |
for line in lines: | |
pair = line.split(':') | |
if len(pair) != 2: | |
continue | |
assert len(pair[1]) == 9 | |
bstr = bytes.fromhex(pair[1][1:]) # convert to byte string |
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
s#!/bin/bash | |
set -e | |
# tensorflow version | |
version=2.6.0 | |
if [[ ! $(head -1 /etc/nv_tegra_release) =~ R32.*6\.1 ]] ; then | |
echo "ERROR: not JetPack-4.6" | |
exit 1 |
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
"""crawl_salaries.py | |
For crawling average salaries of all public listed companies on Taiwan | |
Stock Exchange. Data source: https://mops.twse.com.tw/mops/web/t100sb15 | |
Source code reference: | |
https://blog.techbridge.cc/2019/07/26/how-to-use-taiwan-salary-data-to-do-python-data-analytics-and-data-visualization/ | |
Usage: | |
$ python3 crawl_salaries.py |
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
# Reference: https://michhar.github.io/how-i-built-pytorch-gpu/ | |
# I have a GTX-1080 and a GTX-2080 Ti, thus CUDA_ARCH "6.1" and "7.5". | |
# Patch cmake if necessary: https://github.com/arrayfire/arrayfire/issues/2330 | |
git clone https://github.com/pytorch/pytorch.git pytorch-v1.3.1 | |
cd pytorch-v1.3.1 | |
git checkout v1.3.1 | |
git submodule update --init --recursive |
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
"""disjoint_set.py | |
""" | |
import random | |
class DisjointSet(object): | |
"""DisjointSet |
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
"""caffemodel_nv_to_bvlc.py | |
1. compile the nv-caffe's caffe.proto to caffe_pb2.py | |
2. use caffemodel_nv_to_bvlc.py to convert the nv-caffe caffemodel file | |
into bvlc-caffe compatible format. | |
Example usage: | |
$ cd ${HOME}/project/nv-caffe | |
$ protoc src/caffe/proto/caffe.proto --python_out=. | |
$ python3 ./caffemodel_nv_to_bvlc.py <in.caffemodel> <out.caffemodel> |
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
"""dcgan_mnist.py | |
This script was orginally written by Rowel Atienza (see below), and | |
was modified by JK Jung <jkjung13@gmail.com>. | |
------ | |
DCGAN on MNIST using Keras | |
Author: Rowel Atienza | |
Project: https://github.com/roatienza/Deep-Learning-Experiments |
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
# export YOUR_GCS_BUCKET=oxford-iiit-pets-dataset | |
gcloud ml-engine jobs submit training `whoami`_object_detection_pets_`date +%m_%d_%Y_%H_%M_%S` \ | |
--runtime-version 1.9 \ | |
--job-dir=gs://${YOUR_GCS_BUCKET}/model_dir \ | |
--packages /home/jkjung/src/tensorflow/models/research/dist/object_detection-0.1.tar.gz,/home/jkjung/src/tensorflow/models/research/slim/dist/slim-0.1.tar.gz,/tmp/pycocotools/pycocotools-2.0.tar.gz \ | |
--module-name object_detection.model_main \ | |
--region asia-east1 \ | |
--config cloud-ssd_mobilenet_v1_pets.yml \ | |
-- \ |
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
import numpy as np | |
import keras | |
class DataGenerator(keras.utils.Sequence): | |
'Generates data for Keras' | |
def __init__(self, list_IDs, labels, batch_size=32, dim=(32,32,32), n_channels=1, | |
n_classes=10, shuffle=True): | |
'Initialization' | |
self.dim = dim | |
self.batch_size = batch_size |
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
# -------------------------------------------------------- | |
# Camera Single-Shot Multibox Detector (SSD) sample code | |
# for Tegra X2/X1 | |
# | |
# This program captures and displays video from IP CAM, | |
# USB webcam, or the Tegra onboard camera, and do real-time | |
# object detection with Single-Shot Multibox Detector (SSD) | |
# in Caffe. Refer to the following blog post for how to set | |
# up and run the code: | |
# |
NewerOlder