Skip to content

Instantly share code, notes, and snippets.

@cbovar
cbovar / extract_faces.py
Created May 3, 2020 00:27
extract face in all images from a given folder
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets
import torchvision.models as models
import torchvision.transforms as transforms
from torch.utils import data
from PIL import Image, ImageFile
@cbovar
cbovar / EventToCommandBehavior.cs
Created April 18, 2020 07:54
Generic EventToCommandBehavior
public class EventToCommandBehavior<T> : BehaviorBase<T> where T : BindableObject
{
public static readonly BindableProperty EventNameProperty =
BindableProperty.Create("EventName", typeof(string), typeof(EventToCommandBehavior<T>), null, propertyChanged: OnEventNameChanged);
public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(EventToCommandBehavior<T>));
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(EventToCommandBehavior<T>));
public static readonly BindableProperty InputConverterProperty = BindableProperty.Create("Converter", typeof(IValueConverter), typeof(EventToCommandBehavior<T>));
private Delegate eventHandler;
@cbovar
cbovar / resize.py
Created February 6, 2020 04:16
Resize all image in a given folder, keeping aspect ratio
#!/usr/bin/env python
import os
import sys
import argparse
import math
from PIL import Image
"""
Reduce images size