Skip to content

Instantly share code, notes, and snippets.

View haoxi911's full-sized avatar
🎯
Focusing

Hao Xi haoxi911

🎯
Focusing
View GitHub Profile
@haoxi911
haoxi911 / report.txt
Last active November 8, 2023 16:58
Order discrepancy between ShipStation and DEAR (2023-01-01 to 2023-11-08)
========== SHIPSTATION ORDERS ==========
Found 66454 shipped orders in ShipStation...
============== DEAR SALES ==============
Found 66442 sales in DEAR systems...
===== DUPLICATE SHIPSTATION ORDERS =====
+-----------+--------------+---------------------+---------+
| Order ID | Order Number | Order Date | Status |
+-----------+--------------+---------------------+---------+
@haoxi911
haoxi911 / 9999616949.json
Created November 10, 2022 00:45
ShipStation API Response
{
"orderId": 686882714,
"orderNumber": "9999616949",
"orderKey": "1849507",
"orderDate": "2018-04-16T00:00:00.0000000",
"createDate": "2022-11-09T15:15:09.9970000",
"modifyDate": "2022-11-09T15:15:10.7400000",
"paymentDate": "2018-04-16T00:00:00.0000000",
"shipByDate": null,
"orderStatus": "awaiting_shipment",
@haoxi911
haoxi911 / crash.dump
Created March 4, 2022 16:09
Electron 17.1.0 Crash Report
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: Electron [28492]
Path: /Users/USER/*/Electron.app/Contents/MacOS/Electron
Identifier: com.github.Electron
Version: 17.1.0 (17.1.0)
Code Type: X86-64 (Native)
Parent Process: node [28489]
@haoxi911
haoxi911 / rgb_mode.py
Created March 15, 2018 09:05
Remove invalid images from Oxford IIIT Pet dataset
from PIL import Image
import os
path = os.getcwd()
for folder in os.listdir(path):
if os.path.isdir(os.path.join(path, folder)):
for file in os.listdir(os.path.join(path, folder)):
extension = file.split('.')[-1]
if extension == 'jpg':
fileLoc = os.path.join(path, folder)+'/'+file
img = Image.open(fileLoc)
58266 dog
58432 not_dog
n04507155 1300 umbrella
n03633091 1300 ladle
n03982430 1300 pool table, billiard table, snooker table
n01877812 1300 wallaby, brush kangaroo
n04486054 1300 triumphal arch
n02840245 1300 binder, ring-binder
n04065272 1300 recreational vehicle, RV, R.V.
n01843065 1300 jacamar
n03028079 1300 church, church building
n04330267 1300 stove
@haoxi911
haoxi911 / tflite.sh
Created May 8, 2018 05:35
Script to convert TensorFlow GraphDef to TensorFlow Lite
bazel-bin/tensorflow/contrib/lite/toco/toco \
--input_file=/home/ubuntu/pps_output/output_graph.pb \
--output_file=/home/ubuntu/pps_output/output_graph.tflite \
--input_arrays=Placeholder \
--output_arrays=final_result \
--inference_type=FLOAT \
--input_shapes=1,224,224,3 \
--input_format=TENSORFLOW_GRAPHDEF \
--output_format=TFLITE
@haoxi911
haoxi911 / coreml.py
Created March 16, 2018 02:45
Convert Mobilenet_v1 weights from TensorFlow to CoreML format
import os
import tfcoreml as tf_converter
tf_model_path = os.path.join(os.getcwd(), 'output_graph.pb')
mlmodel_path = os.path.join(os.getcwd(), 'output_graph.mlmodel')
mlmodel = tf_converter.convert(
tf_model_path = tf_model_path,
mlmodel_path = mlmodel_path,
output_feature_names = ['final_result:0'],
input_name_shape_dict = {'input:0':[1,224,224,3]},
@haoxi911
haoxi911 / retrain.sh
Last active March 15, 2018 12:48
Retrain Mobilenet_v1 with Oxford IIIT Pet dataset
# Train
cd ~/tensorflow/
source ./bin/activate
python tensorflow/tensorflow/examples/image_retraining/retrain.py \
--image_dir $(pwd)/datasets/oxford-iiit-pet/images/ \
--learning_rate=0.001 \
--testing_percentage=20 \
--validation_percentage=20 \
--train_batch_size=32 \
--validation_batch_size=-1 \
@haoxi911
haoxi911 / categorize.sh
Created March 15, 2018 09:00
Split images into subfolders on Oxford IIIT Pet dataset
# /bin/sh
# this script categorize image files by moving them into subfolders
# using the name of animals.
for f in *.jpg; do
name=`echo "$f"|sed 's/ -.*//'`
dir=`echo "${name%_*}"|tr '_' ' '| tr '[A-Z]' '[a-z]'`
mkdir -p "$dir"
mv "$f" "$dir"
done