Skip to content

Instantly share code, notes, and snippets.

View SphericalKat's full-sized avatar
🍝
Regretting the spaghetti I'm writing

Amogh Lele SphericalKat

🍝
Regretting the spaghetti I'm writing
View GitHub Profile
# ======================================================================
# There are 5 questions in this exam with increasing difficulty from 1-5.
# Please note that the weight of the grade for the question is relative
# to its difficulty. So your Category 1 question will score significantly
# less than your Category 5 question.
#
# Don't use lambda layers in your model.
# You do not need them to solve the question.
# Lambda layers are not supported by the grading infrastructure.
#
# ======================================================================
# There are 5 questions in this exam with increasing difficulty from 1-5.
# Please note that the weight of the grade for the question is relative
# to its difficulty. So your Category 1 question will score significantly
# less than your Category 5 question.
#
# Don't use lambda layers in your model.
# You do not need them to solve the question.
# Lambda layers are not supported by the grading infrastructure.
#
class YOLO(private val context: Context) {
private val interpreter: Interpreter
// lazily load object labels
private val labelList by lazy { loadLabelList(context.assets) }
// create image processor to resize image to input dimensions
private val imageProcessor by lazy {
ImageProcessor.Builder()
.add(ResizeOp(300, 300, ResizeOp.ResizeMethod.BILINEAR))
class YOLO(private val context: Context) {
// other stuff
// lazily load object labels
private val labelList by lazy { loadLabelList(context.assets) }
private fun loadLabelList(
assetManager: AssetManager
): List<String> {
val labelList = mutableListOf<String>()
class YOLO(private val context: Context) {
private val interpreter: Interpreter
companion object {
private const val MODEL_FILE = "detect.tflite"
private const val LABEL_FILE = "labelmap.txt"
}
init {
val options = Interpreter.Options()
android {
// other stuff
aaptOptions {
noCompress "tflite"
}
}
@SphericalKat
SphericalKat / yolo-build.gradle
Created June 6, 2020 19:51
Gradle deps for yolo object detection app
// Permissions handling
implementation 'com.github.quickpermissions:quickpermissions-kotlin:0.4.0'
// Tensorflow lite
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly'
// CameraView
implementation 'com.otaliastudios:cameraview:2.6.2'
@SphericalKat
SphericalKat / game_model_initial.rs
Created May 7, 2020 15:12
Basic struct representing a Game
#[derive(Serialize, Deserialize)]
pub struct Game {
pub id: Option<i32>,
pub name: String,
pub developer: String,
pub is_goty: bool,
}
@SphericalKat
SphericalKat / hello_world_rocket.rs
Last active May 6, 2020 19:01
Basic hello-world REST API using Rocket
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;
#[get("/<name>")]
fn index(name: String) -> String {
format!("Hello there, {}!", name)
}
fn main() {
@SphericalKat
SphericalKat / docker-compose.yml
Last active April 1, 2020 07:37
Docker compose conf for deploying prod
version: "3.4"
networks:
web:
services:
auth:
image: atechnohazard/hestia-auth
container_name: auth
env_file: ./.env