Skip to content

Instantly share code, notes, and snippets.

View chenghanc's full-sized avatar
🛵
Focusing

chenghanc

🛵
Focusing
View GitHub Profile
#!/usr/bin/env python
# coding: utf-8
# In[40]:
import pandas as pd
import os, glob
import sys
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
def stacked_bar(data, series_labels, category_labels=None,
show_values=False, value_format="{}", y_label=None,
grid=True, reverse=False):
"""Plots a stacked bar chart with the data and labels provided.

Steps to install Deepstream-6.0 on Ubuntu 18.04 LTS and run yolov7 / yolov7 python apps

  • Environment
    • Ubuntu 18.04 LTS
    • Driver Version 495.29.05
    • CUDA 11.3

Deepstream Installation

Installing Gstreamer 1.14.5

import pandas as pd
import os, glob
import sys
# full or absolute path to the folder with txt files
full_path_mo = '/home/nechk/NECHK-Results/cnmo/mo/'
full_path_cn = '/home/nechk/NECHK-Results/cnmo/cn/'
# path for saving files
save_path = '/home/nechk/NECHK-Results/cnmo/image2/'
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter
import pandas as pd
import os, glob
import sys
import seaborn as sns
sns.set()
#%matplotlib inline
import pandas as pd
import os, glob
import sys
# full or absolute path to the folder with txt files
full_path = '/path/to/txt/files/'
# path for saving files
save_path = '/path/for/saving/txt/files/'
# getting the current directory
import pandas as pd
import os, glob
import sys
# full or absolute path to the folder with txt files
full_path = '/path/to/txt/files/'
# path for saving files
save_path = '/path/for/saving/txt/files/'
# getting the current directory
@chenghanc
chenghanc / yolov4.py
Created March 31, 2021 00:58 — forked from YashasSamaga/yolov4.py
YOLOv4 inference using OpenCV DNN
import cv2
import time
CONFIDENCE_THRESHOLD = 0.2
NMS_THRESHOLD = 0.4
COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, 0), (255, 0, 0)]
class_names = []
with open("classes.txt", "r") as f:
class_names = [cname.strip() for cname in f.readlines()]
@url https://major.io/2007/07/05/bintar-argument-list-too-long/
If you find yourself stuck with over 30,000 files in a directory (text files in this example), packing them into a tar file can be tricky. You can get around it with this:
find . -name '*.txt' -print >/tmp/test.manifest
tar -cvzf textfiles.tar.gz --files-from /tmp/test.manifest
find . -name '*.txt' | xargs rm -v

How to install multiple Tensorflow - CUDA versions on the same machine

As Tensorflow is continuously evolving, it is normal to find a situation in which you require multiple versions of Tensorflow to coexist on the same machine. Those versions can be different enough to have different CUDA library dependencies. In this case, you can be tempted to upgrade to the latest release but maybe some of your solutions are still in production or just there are not more holes in your calendar.

In this gist I will cover how to install several CUDA libraries to support different tensorflow verions. However, there are some red lines that you have to respect as the GCC versions, that must be the same, and the nvidia drivers that must support the target CUDA versions. You can check that information in the Tensoroflow website.

The basic idea is to install the CUDA libraries and abuse of the linux system to find the correct libraries when executing the target tensorflow version