This file contains hidden or 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
| https://pjreddie.com/darknet/yolo/ | |
| https://gist.github.com/jeremy-rutman/74c03f4c9a15492227ca22164890d68a | |
| https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects | |
| also see https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects for opencv reading yolo dnn | |
| 1. make train.txt with paths to training jpgs | |
| 2. label files either in parallel dir or same dir (not sure )) | |
| 3. edit cfg/voc.data (locations of train/test files, class names etc) | |
| 4. set to train vs test in .cfg | |
| 5. n_filters in last conv. layer = |
This file contains hidden or 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 pandas as pd | |
| df = pd.read_excel('soxl.xlsx') | |
| df=df[df['IDs of phase known'].notnull() | df['Ids of distance known'].notnull()] | |
| #If you wanted to remove any row with any missing data you can use the builtin : | |
| df = df.dropna() | |
| #which removes any row with missing values (which otherwise get imported as Nan values). |
This file contains hidden or 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 cv2 | |
| import numpy as np | |
| img_arr1 = cv2.imread('test.png') | |
| img_arr = cv2.cvtColor(img_arr1,cv2.COLOR_BGR2GRAY) | |
| ret,mask = cv2.threshold(img_arr,100,200,cv2.THRESH_BINARY) | |
| H,W = mask.shape | |
| left_edges = np.where(mask.any(axis=1),mask.argmax(axis=1),W+1) | |
| flip_lr = cv2.flip(thresh,1) #1 horz vert 0 | |
| right_edges = W-np.where(flip_lr.any(axis=1),flip_lr.argmax(axis=1),W+1) | |
| top_edges = np.where(thresh.any(axis=0),thresh.argmax(axis=0),H+1) |
This file contains hidden or 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 cv2 | |
| #MJPG , DIVX , and H264 | |
| fourcc = cv2.VideoWriter_fourcc(*'XVID') | |
| out = cv2.VideoWriter('output.avi', fourcc, 20.0, (W, H)) | |
| for img_arr in img_arr_list: | |
| out.write(img_arr) |
This file contains hidden or 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
| def get_domain_from_email(email): | |
| pattern = r'(?P<name>\w*)@(?P<subdomain>\w*)\.(?P<domain>\w*)' | |
| match_found = match(pattern, email, flags=IGNORECASE) | |
| print(match_found.group('name')) | |
| print(match_found.group('subdomain')) | |
| print(match_found.group('domain')) | |
| get_domain_from_email('joe_shlabotnik@purple.com') |
This file contains hidden or 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
| /etc/profile - scripts here will run for every new shell/terminal opened | |
| /etc/rc.local - scripts here will run on startup |
This file contains hidden or 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
| ffmpeg -loop 1 -i pic.png -i whoosh.wav -c:a aac -ab 112k -c:v libx264 -shortest -strict -2 whoosh.mp4 |
This file contains hidden or 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
| gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf request_fax.pdf aia0067.pdf | |
| pdfunite request_fax.pdf aia0067.pdf combined.pdf |
This file contains hidden or 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 git | |
| repo = git.Repo(search_parent_directories=True) | |
| sha = repo.head.object.hexsha | |
| short_sha = repo.git.rev_parse(sha, short=1) |
This file contains hidden or 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
| # Uses chardet if encoding is not specified, reading the first kB to determine encoding. | |
| # This obviates the unfortunate situation wherein reading a utf-16 as utf-8 does not generally throw an error, | |
| # but will munge up the data. | |
| import chardet | |
| import pandas as pd | |
| def read_csv_multiformat(f,**kwargs): | |
| if not 'encoding' in kwargs: | |
| with open(f, 'rb') as fp: |