Skip to content

Instantly share code, notes, and snippets.

View Coderx7's full-sized avatar
💭
In God we Trust!

Seyyed Hossein Hasanpour Coderx7

💭
In God we Trust!
  • IRAN
  • 04:44 (UTC +03:30)
View GitHub Profile
import cv2
import numpy as np
import matplotlib.pyplot as plt
# create a simple image
image = np.kron([[1, 0] * 4, [0, 1] * 4] * 4, np.ones((50, 50))).astype(np.uint8) * 255
# test opencv
cv2.imshow('checkboard',image)
cv2.waitKey(0)
# test matplotlib
@Coderx7
Coderx7 / Install NVIDIA Driver and CUDA.md
Created April 11, 2018 19:56 — forked from zhanwenchen/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 8.0 on Ubuntu 16.04.3 LTS
@Coderx7
Coderx7 / pytorch_simplenetv1_imagenet_224_3p_log.txt
Created July 2, 2018 20:13
SimpleNetV1_3p_ImageNet_224_training log (100 epochs, simple SGD) : (67.17 / 87.44)
=> creating model 'simplenetv1_imagenet_3p'
=> Model : simplenetv1_imagenet_3p(
(features): Sequential(
(0): Conv2d(3, 64, kernel_size=[3, 3], stride=(2, 2), padding=(1, 1))
(1): BatchNorm2d(64, eps=1e-05, momentum=0.05, affine=True)
(2): ReLU(inplace)
(3): Conv2d(64, 128, kernel_size=[3, 3], stride=(2, 2), padding=(1, 1))
(4): BatchNorm2d(128, eps=1e-05, momentum=0.05, affine=True)
(5): ReLU(inplace)
(6): Conv2d(128, 128, kernel_size=[3, 3], stride=(1, 1), padding=(1, 1))
#!/usr/bin/env python
#ROS Node to convert a GPS waypoint published on the topic "waypoint" into a 2D Navigation Goal in SLAM to achieve autonomous navigation to a GPS Waypoint
#Converts Decimal GPS Coordinates of waypoint to ROS Position Vector relative to the current gps position of the robot
#Accounts for curvature of the earth using haversine formula
#Depends rospy, std_msgs, geographic_msgs, sensor_msgs, numpy
#Written by Alex McClung, 2015, alex.mcclung@hotmail.com, To be Released Open Source under Creative Commons Attribution Share-Alike Licence
import roslib
import rospy
@Coderx7
Coderx7 / ubuntu_sim_ros_noetic.sh
Last active August 16, 2021 04:33
ubuntu_sim_ros_noetic.sh
#!/bin/bash
## Bash script for setting up ROS Neotic (with Gazebo 9) development environment for PX4 on Ubuntu LTS (20.04).
## It installs the common dependencies for all targets (including Qt Creator)
##
## Installs:
## - Common dependencies libraries and tools as defined in `ubuntu_sim_common_deps.sh`
## - ROS Melodic (including Gazebo9)
## - MAVROS
@Coderx7
Coderx7 / ubuntu_sim_common_deps.sh
Last active August 15, 2021 12:12
ubuntu_sim_common_deps.sh
#!/bin/bash
## Bash script for setting up a PX4 development environment on Ubuntu LTS (16.04 and above).
## It can be used for installing simulators (only) or for installing the preconditions for Snapdragon Flight or Raspberry Pi.
##
## Installs:
## - Common dependencies and tools for all targets (including: Ninja build system, latest versions of cmake, git, anaconda3, pyulog)
## - jMAVSim simulator dependencies
## - PX4/Firmware source (to ~/src/Firmware/)
@Coderx7
Coderx7 / confusionMatrix_Recall_Precision_F1Scroe_Caffe.py
Last active February 24, 2021 13:48
Confusion Matrix with Recall, Precision and F1-Score for Caffe
#!/usr/bin/python
# Author: SeyyedHossein Hasanpour copyright 2017, license GPLv3.
# Seyyed Hossein Hasan Pour:
# Coderx7@Gmail.com
# Changelog:
# 2015:
# initial code to calculate confusionmatrix by Axel Angel
# 7/3/2016:(adding new features-by-hossein)
# added mean subtraction so that, the accuracy can be reported accurately just like caffe when doing a mean subtraction
@Coderx7
Coderx7 / How to build dlib on windows using Visual Studio 2019
Last active August 16, 2020 04:51
How to build dlib on windows using Visual Studio 2019
Here is a gif showing how to do this from the beginning to the very end
@Coderx7
Coderx7 / pytorch_cpu_perf_bkm.md
Created June 9, 2020 02:15 — forked from mingfeima/pytorch_cpu_perf_bkm.md
BKM for PyTorch CPU Performance

General guidelines for CPU performance on PyTorch

This file serves a BKM to get better performance on CPU for PyTorch, mostly focusing on inference or deployment. Chinese version available here.

1. Use mkldnn layout

layout refers to how data is organized in a tensor. PyTorch default layout is NCHW, from optimization perspective, MKL-DNN library (renamed as DNNL recently) may choose a different layout, sometimes refered to as internal layout or primitive layout. This is actually a normal technique for acceleration libraries, common knowledge is that NHWC runs faster than NCHW for convolution, changing the default NCHW to NHWC is called a reorder. MKL-DNN may choose different internal layouts based on the input pattern and the algorithm selected, e.g. nChw16c, a.k.a. reorder a 4-dim tensor into 5-dim by chop down dimension C by 16, for vectorization purpose (AVX512 instruction length is 16x32 bit).

By default on CPU, conv2d will ru

@Coderx7
Coderx7 / main.go
Created April 21, 2020 11:07 — forked from KatelynHaworth/main.go
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}