Skip to content

Instantly share code, notes, and snippets.

View alxfgh's full-sized avatar
🌝

Alexander Al-Feghali alxfgh

🌝
View GitHub Profile
import os
import random
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from scipy.ndimage import shift as scipy_shift
import json
DATA_PATH = 'data'
OUTPUT_PATH = 'dataset'
@alxfgh
alxfgh / Oneko.js
Created March 6, 2024 20:32
Oneko for React
import React, { useEffect, useRef } from "react";
const Oneko = () => {
const nekoElRef = useRef(null);
const timeoutIdRef = useRef(null);
useEffect(() => {
const isReduced =
window.matchMedia(`(prefers-reduced-motion: reduce)`) === true ||
window.matchMedia(`(prefers-reduced-motion: reduce)`).matches === true;
@alxfgh
alxfgh / Half-UNet.py
Last active November 15, 2024 23:22
Half-UNet in PyTorch
# PyTorch implementation of "Half-UNet: A Simplified U-Net Architecture for Medical Image Segmentation"
import torch
import torch.nn as nn
import torch.nn.functional as F
class GhostModule(nn.Module):
def __init__(self, in_channels, out_channels=64):
super(GhostModule, self).__init__()
self.conv1 = nn.Conv2d(in_channels, out_channels // 2, 3, padding=1, bias=False)
self.batch_norm = nn.BatchNorm2d(out_channels // 2)