This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
train_ds = tf.keras.utils.image_dataset_from_directory( | |
train_dir, | |
validation_split=0.1, | |
subset="training", | |
label_mode="categorical", | |
#shuffle=True, | |
seed=123, | |
image_size=(image_size, image_size), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras.backend as K | |
def f1(y_true, y_pred): | |
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) | |
possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) | |
predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) | |
precision = true_positives / (predicted_positives + K.epsilon()) | |
recall = true_positives / (possible_positives + K.epsilon()) | |
f1_val = 2*(precision*recall)/(precision+recall+K.epsilon()) | |
return f1_val | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArrayListExample { | |
public static void main(String[] args) { | |
MyArrayList<Long> listOfInts = new MyArrayList<>(); | |
listOfInts.push(20L); | |
listOfInts.push(23L); | |
listOfInts.push(22L); | |
listOfInts.push(24L); | |
listOfInts.remove(23L); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
import threading | |
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
socket.connect(('127.0.0.1', 9999)) | |
def read_from_socket(socket): | |
while True: | |
message = socket.recv(2048) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Template { | |
id: string; | |
name: string; | |
} | |
interface Document { | |
} | |
interface State { | |
templates: Template[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define IR_SEND_PIN 27 | |
#include <IRremote.h> | |
int RECV_PIN = 14; | |
IRrecv irrecv(RECV_PIN); | |
IRsend irsend; | |
int lastAddress = 1; | |
int lastCommand = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <IRremote.h> | |
int RECV_PIN = 2; | |
IRrecv irrecv(RECV_PIN); | |
void setup() { | |
Serial.begin(9600); | |
irrecv.enableIRIn(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ai.spector; | |
import com.adobe.xmp.XMPIterator; | |
import com.adobe.xmp.XMPMeta; | |
import com.adobe.xmp.properties.XMPPropertyInfo; | |
import com.drew.imaging.ImageMetadataReader; | |
import com.drew.metadata.Directory; | |
import com.drew.metadata.Metadata; | |
import com.drew.metadata.Tag; | |
import com.drew.metadata.xmp.XmpDirectory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lombok.Data; | |
import java.util.*; | |
public class MainIndex { | |
public static void main(String[] args) { | |
Map<String, Set<Post>> postFullText = new HashMap<>(); | |
Post p1 = new Post(); | |
p1.id = 1L; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFi.h> | |
#include <WiFiAP.h> | |
#include <DNSServer.h> | |
#include <ESPAsyncWebServer.h> | |
#include <ArduinoJson.h> | |
#include <AsyncJson.h> | |
#define index_html "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0\"><meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\"><title>Document</title></head><body><div style=\"display: flex; justify-content: space-between; padding-top: 100px;\"><div style=\"display: flex; width: 200px;transform: rotate(-90deg);\"><input type=\"range\" min=\"-1\" max=\"1\" step=\"0.1\" value=\"0\" id=\"throttle\"></div><div style=\"display: flex; width: 200px;\"><input type=\"range\" min=\"-1\" max=\"1\" step=\"1\" value=\"0\" id=\"steering-wheel\"></div></div><script>const throttleEl = document.getElementById('throttle');const steeringWheelEl = document.getElementById('steering-wheel');function sendState() {console.log(throttleEl.value, steeringW |