Skip to content

Instantly share code, notes, and snippets.

View mehdidc's full-sized avatar

Mehdi Cherti mehdidc

View GitHub Profile
@mehdidc
mehdidc / config.yaml
Created September 24, 2021 05:32
Config example with diversity
lr: 0.001
epochs: 10
noise_dim: 128
dim: 128
depth: 8
vq_image_size: 16
dropout: 0
cutn: 16
batch_size: 2
repeat: 8
This file has been truncated, but you can view the full file.
https://i.pinimg.com/736x/66/01/6c/66016c3ba27c0e04f39e2bd81a934e3e--anita-ekberg-bob-hope.jpg
http://www.standard.net/image/2015/02/04/800x_a16-9_b0_q81_p1/winter-fly-fishing.jpg
http://indianapolis-photos.funcityfinder.com/files/2009/12/Clearwater-Crossing-Shopping-Center-sign-Indianapolis-Indiana.jpg
http://www.abc.net.au/news/image/9066492-3x2-700x467.jpg
https://www.featurepics.com/StockImage/20090316/carrying-globe-stock-image-1115085.jpg
http://i.dailymail.co.uk/i/pix/2014/11/05/1415187324676_wps_31_Home_is_a_little_Deer_Ivy.jpg
http://www.waste360.com/sites/waste360.com/files/styles/article_featured_standard/public/Trista%2002%20007_0.jpg?itok=F1eJZsX3
https://media.gettyimages.com/photos/young-woman-seated-on-the-beach-picture-id97545987?s=612x612
https://worldjourneysdiscover.files.wordpress.com/2014/07/kyoto-07.jpg?w=860&h=645
http://piquemagazine.uk/wp-content/uploads/2017/10/LPO-24-Feb-Albrecht-Menzel-%C2%AE-Anne-Hornemann-300dpi.jpg
import os
from imageio import imread
import pandas as pd
import lmdb
from caffe2.proto import caffe2_pb2
# Folder should contain a set of images
image_folder = "flickr30k_images"
# CSV should contain image filenames with corresponding captions
dataframe_path = "flickr30k_images/results.csv"
#!/usr/bin/env bash
set -e
cd
case "$OSTYPE" in
darwin*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh ;;
linux*) DOWNLOAD=https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh ;;
*) echo "unknown: $OSTYPE" ;;
esac
@mehdidc
mehdidc / tensorboard_to_csv.py
Created June 21, 2020 11:54
tensorboard_to_csv
#Credits to https://stackoverflow.com/questions/49697634/tensorboard-export-csv-file-from-command-line
from collections import defaultdict
import argparse
import numpy as np
import tensorflow as tf
from clize import run
import pandas as pd
def save_tag_to_csv(fn):
sess = tf.InteractiveSession()
#!/bin/bash
# This file sets the environment variable CUDA_VISIBLE_DEVICES to the MPI local rank to enable multi-GPU usage of this benchmark. Note that this disables any GPU distribution handling by he batch scheduler.
# Background: Most/some batch schedulers set CUDA_VISIBLE_DEVICES to all available GPUs on a node. In that case, the Arbor benchmark would only use the first entry in the list, probably GPU#0. This script changes that.
# -Andreas Herten, Nov 2018
_verbose=1
localrank=$CUDA_VISIBLE_DEVICES
if [[ -n "$OMPI_COMM_WORLD_NODE_RANK" ]]; then
@mehdidc
mehdidc / scanner.sh
Created May 12, 2020 20:50 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@mehdidc
mehdidc / nes.py
Created December 24, 2018 13:25 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
"""
import numpy as np
np.random.seed(0)
# the function we want to optimize

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
@mehdidc
mehdidc / tensorflow_finetune.py
Created June 8, 2018 07:03 — forked from omoindrot/tensorflow_finetune.py
Example TensorFlow script for fine-tuning a VGG model (uses tf.contrib.data)
"""
Example TensorFlow script for finetuning a VGG model on your own data.
Uses tf.contrib.data module which is in release v1.2
Based on PyTorch example from Justin Johnson
(https://gist.github.com/jcjohnson/6e41e8512c17eae5da50aebef3378a4c)
Required packages: tensorflow (v1.2)
Download the weights trained on ImageNet for VGG:
```
wget http://download.tensorflow.org/models/vgg_16_2016_08_28.tar.gz