Skip to content

Instantly share code, notes, and snippets.

View Merwanski's full-sized avatar
:electron:
Focusing

Merwanski

:electron:
Focusing
  • Belgium
  • Belgium
View GitHub Profile
@Merwanski
Merwanski / client.py
Created November 24, 2021 13:52
client.py
#!/usr/bin/env python3
import sys
from socket import socket, AF_INET, SOCK_DGRAM
# TODO update this part with the IP address of the server and port number used
SERVER_IP = '172.19.0.3'
PORT_NUMBER = 5000
SIZE = 1024
print ("Test client sending packets to IP {0}, via port {1}\n".format(SERVER_IP, PORT_NUMBER))
@Merwanski
Merwanski / docker_logs.py
Created November 24, 2021 13:43
Docker container logs
# Docker container logs
import datetime
import docker
import time
import os
# how to run it
# python3 docker_logs.py
# TODO update the name for the correct one on the drone
@Merwanski
Merwanski / server.py
Created November 24, 2021 13:39
server.py
#!/usr/bin/env python3
from socket import socket, gethostbyname, AF_INET, SOCK_DGRAM
import sys
PORT_NUMBER = 5000
SIZE = 1024
hostName = gethostbyname( '0.0.0.0' )
mySocket = socket( AF_INET, SOCK_DGRAM )
@Merwanski
Merwanski / tcp_image_stream.py
Created November 24, 2021 13:33
image streaming tcp
import sys
import cv2
# TODO update with this part with your ip address
cap = cv2.VideoCapture("tcp://192.168.68.97:18003")
while(True):
ret, frame = cap.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
@Merwanski
Merwanski / convert_pascal_annotation_to_yolo.py
Last active November 24, 2021 13:31
convert pascal annotation to yolo
import xml.etree.ElementTree as ET
import pickle
import os,sys
from os import listdir, getcwd
from os.path import join
# TODO
classes = [""] # update with the classes of your dataset
def convert(size,box):