Skip to content

Instantly share code, notes, and snippets.

View patharanordev's full-sized avatar
🤝
Focusing

PatharaNor patharanordev

🤝
Focusing
View GitHub Profile
@patharanordev
patharanordev / coco.sh
Created April 18, 2021 03:41 — forked from mkocabas/coco.sh
Download COCO dataset. Run under 'datasets' directory.
mkdir coco
cd coco
mkdir images
cd images
wget http://images.cocodataset.org/zips/train2017.zip
wget http://images.cocodataset.org/zips/val2017.zip
wget http://images.cocodataset.org/zips/test2017.zip
wget http://images.cocodataset.org/zips/unlabeled2017.zip
@patharanordev
patharanordev / press-to-continue.sh
Created April 10, 2021 13:55
Simple press key to continue new shell script
echo "Press 'q' to continue"
count=0
while : ; do
read -n 1 k <&1
if [[ $k = q ]] ; then
break
fi
done

Solved ImportError: libGL.so.1: cannot open shared object file: No such file or directory

When using cv2 in Dockerfile.

Adding library below to your Dockerfile to solve the issue :

RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y
@patharanordev
patharanordev / example-plot-img-grid.md
Last active March 27, 2021 09:58
Using matplotlib to plot image grid M x N

Plot image grid M x N via matplotlib

The example below, try to show predicted result image & label on VGG19 model, I have set grid size to N x 5 :

  • multi-rows
  • 5-columns

I have directory structure like this

content
@patharanordev
patharanordev / long-run-colab.md
Created March 8, 2021 14:54
To prevent CoLab's session loss

Long run CoLab

In CoLab, press (CTRL + SHIFT + i) to open inspect window. Go to console tab then press source code below and press enter :

function ClickConnect(){
console.log("Working"); 
document
 .querySelector('#top-toolbar &gt; colab-connect-button')
@patharanordev
patharanordev / cv2_img_encode_base64.md
Last active August 15, 2023 01:17
Convert image from cv2.imread to img.src in HTML

Encode image in nparray to base64

Encode base64 function:

import cv2
import base64

def encode_img(img, im_type):
 """Encodes an image as a png and encodes to base 64 for display."""

Fixed gem install cocoapods

If you found error message like this :

Error installing cocoapods: ERROR: Failed to build gem native extension

You should re-install ruby first before install cocoapods.

$ brew reinstall ruby
@patharanordev
patharanordev / convert-pt-to-onnx.md
Created March 6, 2021 04:27
How-to-convert `.pt` to `.onnx` model file format.

Convert .pt to .onnx

The function using in Scaled-YOLOv4, please refer to Scaled-YOLOv4 repository.

Before start, the export script requires onnxsim, you need to install it first :

$ pip install -q onnx-simplifier
@patharanordev
patharanordev / opencv-mac-camera.md
Last active March 4, 2021 01:22
OpenCV using camera in MacOS

If You are Using MAC, I Actually Solved this Issue By Granting Permission for Terminal To Access Camera in Security and Privacy Section in System Preferences. Hope This Solves Issue In Your Mac Click Here To View Steps

@patharanordev
patharanordev / test_plaidml_vgg.py
Created February 14, 2021 04:10
Test PlaidML performance via simple VGG model
#!/usr/bin/env python
import numpy as np
import os
import time
os.environ['KERAS_BACKEND'] = 'plaidml.keras.backend'
import keras
import keras.applications as kapp