Skip to content

Instantly share code, notes, and snippets.

View innat's full-sized avatar
:octocat:
Working from home

Mohammed Innat innat

:octocat:
Working from home
View GitHub Profile
@innat
innat / FFmpeg | Basic Operation on Subtitles.md
Last active February 21, 2024 02:32
Remove hard subtitles from video file || Integrate subtitles into a video file || Generate .srt file from a video file.

Download FFmpeg for Windows

Steps

  • Download FFmpeg
  • Extract it and save it to C drive ( choose any location - it's optional )
  • Set environment variable - copy the location of bin folder which is inside the extracted file and set the location on system path variable.
  • Done!
import tensorflow as tf
from tensorflow.keras import layers
H_AXIS = -3
W_AXIS = -2
class RandomCutout(layers.Layer):
"""Randomly cut out rectangles from images and fill them.
Args:
@innat
innat / X11 Forwarding using Putty on Windows.md
Created May 8, 2018 15:23
Setting show to execute Linux GUI apps remotely using ssh - putty client and forwarding X11 content to a local windows Xming

Necessary Softwar

Install all of them and using putty remotely access to raspberry pi. We need to configure something.Type following command to edit a config file.

sudo nano /etc/ssh/ssh_config

following item need to change..

@innat
innat / ImageCenter.md
Created November 11, 2018 23:05
Center Images in GitHub README.md

For left alignment

 <img align="left" width="600" height="200" src="https://www.python.org/python-.png">

For right alignment

<img align="right" width="600" height="200" src="https://www.python.org/python-.png">

And for center alignment

# set plot figure size
fig, c_ax = plt.subplots(1,1, figsize = (12, 8))
def multiclass_roc_auc_score(y_test, y_pred, average="macro"):
lb = LabelBinarizer()
lb.fit(y_test)
y_test = lb.transform(y_test)
y_pred = lb.transform(y_pred)
for (idx, c_label) in enumerate(all_labels): # all_labels: no of the labels, for ex. ['cat', 'dog', 'rat']
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import Model
from tensorflow.keras import layers
class ConvoBlocks(tf.keras.layers.Layer):
def __init__(self, num_filters=256,
kernel_size=3, dilation_rate=1,
padding="same", use_bias=False, **kwargs):
super(ConvoBlocks, self).__init__(**kwargs)
@innat
innat / Polygon-to-Mask (Multi-Class).py
Last active November 10, 2023 08:25
Utility function to create mask (png) from polygon (json).
# Case 2: Multiple Class Maks
# String to integer labels.
# Assuming we havae 5 classes like below (excluding background).
categories = {
'human' : 1,
'dog' : 2,
'cat' : 3,
'bus' : 4,
'road' : 5
# RESTRICT TENSORFLOW TO 2GB OF GPU RAM
# SO THAT WE HAVE 14GB RAM free
LIMIT = 2.0
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
tf.config.experimental.set_virtual_device_configuration(
gpus[0],
[tf.config.experimental.VirtualDeviceConfiguration(memory_limit=1024*LIMIT)])
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
"""
Reference
# https://github.com/fuenwang/PanoramaUtility
# https://github.com/fuenwang/Equirec2Perspec
# https://github.com/fuenwang/PanoramaUtility
# https://github.com/timy90022/Perspective-and-Equirectangular
"""
import os
import sys
# Base Image: Ubuntu + Cuda
FROM nvidia/cuda:11.0.3-devel-ubuntu20.04 AS python_base_cuda
# ENV SET
ENV PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \