Skip to content

Instantly share code, notes, and snippets.

View yearofthewhopper's full-sized avatar
💭
Training another CNN

Noland Chaliha yearofthewhopper

💭
Training another CNN
View GitHub Profile
class FeatureX(nn.Module):
def __init__(self):
super(FeatureX, self).__init__()
vgg19_model = models.vgg19(pretrained=True)
self.feature_extractor = nn.Sequential(*list(vgg19_model.features.children())[:18])
def forward(self, img):
return self.feature_extractor(img)
void main() {
vec4 textureColor = texture2D(sTexture, vTextureCoord);
vec3 fragRGB = textureColor.rgb;
vec3 fragHSV = rgb2hsv(fragRGB);
float h = vHSV.x / 360.0;
fragHSV.x *= h;
fragHSV.yz *= vHSV.yz;
fragHSV.x = mod(fragHSV.x, 1.0);
fragHSV.y = mod(fragHSV.y, 1.0);
fragHSV.z = mod(fragHSV.z, 1.0);
#source https://github.com/matterport/Mask_RCNN/issues/1361
#You can 'filter out' classes you don't need after you run the detection but it doesn't prune the weights though. So, I'm not sure it would speed things up. Hope it helps.
# COCO class names
class_names = ['BG', 'person', 'bicycle', 'car', 'motorcycle', 'airplane',
'bus', 'train', 'truck', 'boat', 'traffic light',
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird',
'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear',
'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie',
const Scene = require('Scene');
const Reactive = require('Reactive');
const TouchGestures = require('TouchGestures')
var mug_ctrl = Scene.root.find('portal')
var planeTracker = Scene.root.find('planeTracker0');
TouchGestures.onTap().subscribe(function(gesture) {
const Scene = require('Scene')
const Animation = require('Animation')
Scene.root.findFirst('emitter0').then(obj => {
const alphaSampler = Animation.samplers.HSVA([
Animation.samplers.constant(1),
Animation.samplers.constant(1),
Animation.samplers.constant(1),
Animation.samplers.easeInQuad(1, 0)
]);
import { Particle } from './Particle';
import { Ease } from './PFTween';
const FaceTracking = require("FaceTracking");
const HeadRotationTrigger = require("./sparkar-head-rotation-trigger.js");
const EventHelpers = require("./sparkar-event-helpers.js");
const Scene = require('Scene');
const TouchGestures = require('TouchGestures');
const Diagnostics = require('Diagnostics');
//==============================================================================
// The following example demonstrates how to store, retrieve and remove data
// across multiple sessions.
//
// Project setup:
// - Insert two rectangles
// - Insert text
// - Position the rectangles and text so that all are visible
// - Add 'data' to 'Whitelisted keys' under the 'Persistence' Capability
// - Add the 'Tap Gesture' capability under 'Touch Gestures'
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Plexus
// Collab by Ben Ursu & Dan Cronin | Afrosquared
// Spark AR Studio
// Instagram | https://www.instagram.com/a/r/?effect_id=2029175904053487
@yearofthewhopper
yearofthewhopper / script.js
Created September 27, 2020 22:33 — forked from lassemt/script.js
SparkAR requestAnimationFrame alternative.
const t = require('Time');
const D = require('Diagnostics');
const Scene = require('Scene');
const objText = Scene.root.find('2dText0');
let frame = 0;
const round = (val, precision = 1) => {
const multiplier = Math.pow(10, precision || 0);
return Math.round(val * multiplier) / multiplier;
import os
import numpy as np
import cv2
from keras.applications.imagenet_utils import preprocess_input
from keras.layers import Dense, Reshape
from keras.models import Sequential, Model, load_model
from keras.applications.resnet50 import ResNet50
from keras.optimizers import Adam