Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#change base_lr
#note nclasses bases+count
curl -X DELETE "http://localhost:8080/services/tag_detect?clear=all"
sleep 1
docker stop dd_tags
docker rm dd_tags
#!/bin/bash
curl -X PUT "http://localhost:8080/services/artwork_detect_vgg16" -d '{
"mllib": "caffe",
"description": "detector vgg16",
"type": "supervised",
"parameters": {
"input": {
"connector": "image",
"db": true,
@dgtlmoon
dgtlmoon / script.sh
Last active June 29, 2020 19:31
deepdetect vgg16 finetune (before simsearch with finetuned weights)
#!/bin/bash
#change base_lr
curl -X DELETE "http://localhost:8080/services/tag_detect_vgg16?clear=all"
sleep 1
docker stop dd_tags
docker rm dd_tags
chmod -R 777 models
nvidia-docker run --name dd_tags -d -p 8080:8080 -v "`pwd`":/tags_dataset jolibrain/deepdetect_gpu

Some machine learning image cleanup tricks

Print files larger than some size

identify -format '%f|%w|%h\n' *|awk -F\| ' $3> 512 || $3 > 512'

856x642-manual-0fc7abf38681f7195e0588643037a7a7.jpg|856|642
856x642-manual-4bcae3ee8401e05c1da869e2ce0f154f.jpg|856|642
856x642-manual-5b9e571e0a4638cee70a92865d97bedd.jpg|856|642
#!/usr/bin/python3
import argparse
from PIL import Image, ExifTags
# Given the training index file and a maximum size (used as width and height)
# Resize anything larger than these and rewrite their scaled bbox information
# ALSO - always rotates the image if there is EXIF data!
import glob
import sys
#!/usr/bin/python3
"""
DOES NOT WORK because requests (and requests_cache) are blocking, if you have some ideas..
https://stackoverflow.com/questions/52246796/await-a-method-and-assign-a-variable-to-the-returned-value-with-asyncio
"""
import asyncio
import re