Skip to content

Instantly share code, notes, and snippets.

@kevinn1999
kevinn1999 / LossEvalHook.py
Created November 10, 2021 02:37 — forked from ortegatron/LossEvalHook.py
Trainer with Loss on Validation for Detectron2
from detectron2.engine.hooks import HookBase
from detectron2.evaluation import inference_context
from detectron2.utils.logger import log_every_n_seconds
from detectron2.data import DatasetMapper, build_detection_test_loader
import detectron2.utils.comm as comm
import torch
import time
import datetime
class LossEvalHook(HookBase):
#!/usr/bin/env bash
# #
# # Install main dependencies on CentOS:
# # Python 3.4.5, CMake 3.10.0, OpenCV 3.3.1
# # Author Andrii Lundiak (landike@gmail.com)
# #
# https://github.com/ageitgey/face_recognition/issues/191
# https://github.com/opencv/opencv/issues/8471
@kevinn1999
kevinn1999 / install_ffmpeg_centos_7.sh
Created December 10, 2020 00:51 — forked from AdrianHL/install_ffmpeg_centos_7.sh
Install FFmpeg in CentOS 7
#!/bin/sh
yum -y update
yum -y install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel freetype-devel speex-devel ladspa-devel mercurial cmake
mkdir ~/ffmpeg_sources
#NASM
cd ~/ffmpeg_sources
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.bz2
@kevinn1999
kevinn1999 / install_ffmpeg_centos_7.sh
Created December 10, 2020 00:51 — forked from AdrianHL/install_ffmpeg_centos_7.sh
Install FFmpeg in CentOS 7
#!/bin/sh
yum -y update
yum -y install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel freetype-devel speex-devel ladspa-devel mercurial cmake
mkdir ~/ffmpeg_sources
#NASM
cd ~/ffmpeg_sources
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.bz2
@kevinn1999
kevinn1999 / client.py
Created August 3, 2020 00:48 — forked from kylehounslow/client.py
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@kevinn1999
kevinn1999 / client.py
Created July 18, 2020 12:40
simple python client/server socket binary stream
import socket
HOST = 'localhost'
PORT = 9876
ADDR = (HOST,PORT)
BUFSIZE = 4096
videofile = "videos/royalty-free_footage_wien_18_640x360.mp4"
bytes = open(videofile).read()
@kevinn1999
kevinn1999 / client.py
Created July 17, 2020 06:28 — forked from kittinan/client.py
Python OpenCV webcam send image frame over socket
import cv2
import io
import socket
import struct
import time
import pickle
import zlib
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('192.168.1.124', 8485))