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!
View GitHub Profile
@Coderx7
Coderx7 / tinyimagenet_classIds.txt
Created April 23, 2025 12:14
tinyimagenet class IDs
n01443537
n01629819
n01641577
n01644900
n01698640
n01742172
n01768244
n01770393
n01774384
n01774750
@Coderx7
Coderx7 / create_tiny_imagenet_classnames.py
Last active April 23, 2025 12:17
creates tiny imagenet class names from imagenet classnames
import os
import json
import requests
def download_file(url, path):
if not os.path.exists(path):
response = requests.get(url)
# if download failed raise exception
response.raise_for_status()
with open(path, 'w', encoding='utf-8') as file:
@Coderx7
Coderx7 / tinyimagenet_labels.txt
Created April 23, 2025 11:09
tiny imagenet class names
goldfish
European_fire_salamander
bullfrog
tailed_frog
American_alligator
boa_constrictor
trilobite
scorpion
black_widow
tarantula
@Coderx7
Coderx7 / imagenet_class_index.json
Created April 23, 2025 07:46
imagenet_class_index.json
{"0": ["n01440764", "tench"], "1": ["n01443537", "goldfish"], "2": ["n01484850", "great_white_shark"], "3": ["n01491361", "tiger_shark"], "4": ["n01494475", "hammerhead"], "5": ["n01496331", "electric_ray"], "6": ["n01498041", "stingray"], "7": ["n01514668", "cock"], "8": ["n01514859", "hen"], "9": ["n01518878", "ostrich"], "10": ["n01530575", "brambling"], "11": ["n01531178", "goldfinch"], "12": ["n01532829", "house_finch"], "13": ["n01534433", "junco"], "14": ["n01537544", "indigo_bunting"], "15": ["n01558993", "robin"], "16": ["n01560419", "bulbul"], "17": ["n01580077", "jay"], "18": ["n01582220", "magpie"], "19": ["n01592084", "chickadee"], "20": ["n01601694", "water_ouzel"], "21": ["n01608432", "kite"], "22": ["n01614925", "bald_eagle"], "23": ["n01616318", "vulture"], "24": ["n01622779", "great_grey_owl"], "25": ["n01629819", "European_fire_salamander"], "26": ["n01630670", "common_newt"], "27": ["n01631663", "eft"], "28": ["n01632458", "spotted_salamander"], "29": ["n01632777", "axolotl"], "30": ["n016
@Coderx7
Coderx7 / edgetaper.py
Created June 14, 2024 15:09
edgetaper implementation in numpy/opencv
# this is a python reimplementation of edgetaper introduced here: https://docs.opencv.org/4.x/d1/dfd/tutorial_motion_deblur_filter.html
def edgetaper(img, gamma=5, beta=0.2):
width,height = img.shape[:2]
dx = 2 * np.pi / width
dy = 2 * np.pi / height
# subtract dx and dy to match original function's range
x = np.linspace(-np.pi, np.pi-dx, width)
y = np.linspace(-np.pi, np.pi-dy, height)
w1 = 0.5 * (np.tanh((x + gamma / 2) / beta) - np.tanh((x - gamma / 2) / beta))
w2 = 0.5 * (np.tanh((y + gamma / 2) / beta) - np.tanh((y - gamma / 2) / beta))
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 / 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/)
#!/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, [email protected], To be Released Open Source under Creative Commons Attribution Share-Alike Licence
import roslib
import rospy
@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