This file contains 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 | |
# Load YOLO | |
net = cv2.dnn.readNet("./yolov2.weights", "./cfg/yolov2.cfg") | |
classes = [] | |
with open("./data/coco.names", "r") as f: | |
classes = [line.strip() for line in f] | |
# Set up OpenCV video capture |
This file contains 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 os | |
import cv2 | |
import glob | |
from pathlib import Path | |
FOLDER_VIDEOS = "<<PATH>>/*.mp4" | |
FOLDER_FRAMES = "<<PATH>>" | |
for i, video in enumerate(glob.glob(FOLDER_VIDEOS)): |
This file contains 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
# pip install ipykernel | |
python -m ipykernel install --user --name .env --display-name ".env" |
This file contains 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
echo "backend: TkAgg" > ~/.matplotlib/matplotlibrc | |
# https://stackoverflow.com/questions/52629661/matplotlib-3-0-with-osx-backend |
This file contains 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 | |
scale = 0.00392 | |
classes_file = "coco.names" | |
weights = "yolov2.weights" | |
config_file = "yolov2.cfg" | |
# read class names from text file | |
classes = None |
This file contains 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
/* | |
Suppose the file has these values | |
inf1 inf2 | |
*/ | |
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main () { |
This file contains 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
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
bool fexists(const char *filename) | |
{ | |
ifstream ifile(filename); | |
return ifile; | |
} |