Skip to content

Instantly share code, notes, and snippets.

View jkjung-avt's full-sized avatar

JK Jung jkjung-avt

View GitHub Profile
@jkjung-avt
jkjung-avt / openalpr_camera.py
Last active December 20, 2023 20:36
Real-time license plate recognition with 'openalpr' using a video file as input. Please check out my "Building and Testing 'openalpr' on Jetson TX2" post for more information: https://jkjung-avt.github.io/openalpr-on-tx2/
# test_camera.py
#
# Open an RTSP stream and feed image frames to 'openalpr'
# for real-time license plate recognition.
import numpy as np
import cv2
from openalpr import Alpr
@jkjung-avt
jkjung-avt / install_tensorflow-2.6.0.sh
Last active October 19, 2023 13:58
Scripts for installing tensorflow-2.6.0 on JetPack-4.6
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
@jkjung-avt
jkjung-avt / tegra-cam.py
Last active October 11, 2023 08:20
Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera.
# --------------------------------------------------------
# Camera sample code for Tegra X2/X1
#
# This program could capture and display video from
# IP CAM, USB webcam, or the Tegra onboard camera.
# Refer to the following blog post for how to set up
# and run the code:
# https://jkjung-avt.github.io/tx2-camera-with-python/
#
# Written by JK Jung <jkjung13@gmail.com>
@jkjung-avt
jkjung-avt / camera-ssd-threaded.py
Last active June 20, 2023 15:11 — forked from ck196/ssd_500_detect.py
Capture live video from camera and do Single-Shot Multibox Detector (SSD) object detetion in Caffe on Jetson TX2/TX1.
# --------------------------------------------------------
# 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:
#
@jkjung-avt
jkjung-avt / tegra-cam-caffe-threaded.py
Last active May 21, 2023 05:00
Capture live video from camera and do Caffe image classification on Jetson TX2/TX1.
# --------------------------------------------------------
# Camera Caffe 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
# image classification (inference) with Caffe. Refer to the
# following blog post for how to set up and run the code:
#
# https://jkjung-avt.github.io/camera-caffe-threaded/
#
@jkjung-avt
jkjung-avt / gcp-run.sh
Created September 29, 2018 06:35
Example command to initiate a GCP ML training job
# 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 \
-- \
@jkjung-avt
jkjung-avt / caffemodel_nv_to_bvlc.py
Last active August 29, 2022 08:21
Script to convert a nv-caffe saved caffemodel file into another file which could be read by bvlc-caffe
"""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>
@jkjung-avt
jkjung-avt / crawl_salaries.py
Last active July 18, 2022 09:10
從公開資訊觀測站下載108年度台灣上市、上櫃公司 "非擔任主管職務之全時員工薪資資訊"
"""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
@jkjung-avt
jkjung-avt / dcgan_mnist.py
Created October 28, 2018 09:44
A simple DCGAN with MNIST
"""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
@jkjung-avt
jkjung-avt / data_generator.py
Created August 31, 2018 12:14
An example multiprocessing-ready data generator for Keras, taken from https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly
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