Skip to content

Instantly share code, notes, and snippets.

View david-littlefield's full-sized avatar

david-littlefield

View GitHub Profile
@david-littlefield
david-littlefield / center_object_in_composition.js
Last active April 17, 2022 21:38
[Center Object in Composition] Places object in center of composition. #after_effects #center #vertical #horizontal #text #shape #position
// Transform > Position > Code
var composition_width = thisComp.width;
var composition_height = thisComp.height;
var x_value = composition_width / 2;
var y_value = composition_height / 2;
[x_value, y_value];
@david-littlefield
david-littlefield / center_anchor_point.js
Created April 16, 2022 23:28
[Center Anchor Point] Places anchor point in center of object. #after_effects #center #anchor_point #text #shape #vertical #horizontal
// Transform > Anchor Point > Code
var object_layer = thisComp.layer("Controller");
var object_rectangle = object_layer.sourceRectAtTime();
var object_left = object_rectangle.left;
var object_top = object_rectangle.top;
var object_width = object_rectangle.width;
var object_height = object_rectangle.height;
var x_value = object_left + (object_width / 2);
var y_value = object_top + (object_height / 2);
@david-littlefield
david-littlefield / align_text_at_bottom.js
Created April 16, 2022 23:22
[Align Text at Bottom] Aligns text at bottom #after_effects #align #bottom #text #anchor_point
// Transform > Anchor Point > Code
var text_rectangle = thisLayer.sourceRectAtTime(time, false);
var text_left = text_rectangle.left;
var text_top = text_rectangle.top;
var text_width = text_rectangle.width;
var text_height = text_rectangle.height;
var x_value = text_left;
var y_value = text_top + text_height;
[x_value, y_value];
@david-littlefield
david-littlefield / resize_background_to_fit_text.js
Last active April 16, 2022 23:41
[Resize Background to Fit Text] Resizes shape object to fit text object. Size of shape object is increased with padding. #after_effects #padding #text #background #resize #shape
// Contents > Rectangle > Rectangle Path > Shape > Code
var padding_value = thisComp.layer("Controller").effect("Padding")("Slider");
var text_layer = thisComp.layer("Subtitle");
var text_rectangle = text_layer.sourceRectAtTime();
var text_width = text_rectangle.width;
var text_height = text_rectangle.height;
var text_background_width = text_width + (padding_value * 2);
var text_background_height = text_height + (padding_value * 2);
[text_background_width, text_background_height];
@david-littlefield
david-littlefield / center_text_in_background.js
Last active April 27, 2022 20:11
[Center Text in Background] Places text object in center of shape object. Text object must be center aligned. #after_effects #horizontal #vertical #center #text #background #position
// Transform > Position > Code
var text_composition = comp("Top");
var text_layer = text_composition.layer("Subtitle");
var text_rectangle = text_layer.sourceRectAtTime();
var text_left = text_rectangle.left;
var text_top = text_rectangle.top;
var text_width = text_rectangle.width;
var text_height = text_rectangle.height;
# sets user to default user for web server
user www-data;
# sets number of cpu cores to use
worker_processes auto;
# customizes how to handle connections
events {
# sets number of connections to use per cpu core

REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2018/06/19 18:47


NOTES

AppleScript is a rather peculiar scripting language to learn.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from fastai.vision.all import *
from fastbook import *
file_directory = untar_data(URLs.MNIST_SAMPLE)
training_3_file_paths = (file_directory/'train'/'3').ls().sorted()
training_3_tensors = [tensor(Image.open(file_path)) for file_path in training_3_file_paths]
training_3_tensors = torch.stack(training_3_tensors).float() / 255
training_7_file_paths = (file_directory/'train'/'7').ls().sorted()
training_7_tensors = [tensor(Image.open(file_path)) for file_path in training_7_file_paths]
parser = argparse.ArgumentParser(description='DSFD:Dual Shot Face Detector')
parser.add_argument('--trained_model', default='weights/WIDERFace_DSFD_RES152.pth',
type=str, help='Trained state_dict file path to open')
parser.add_argument('--save_folder', default='eval_tools/', type=str,
help='Dir to save results')
parser.add_argument('--visual_threshold', default=0.1, type=float,
help='Final confidence threshold')
parser.add_argument('--cuda', default=False, type=bool,
help='Use cuda to train model')