Skip to content

Instantly share code, notes, and snippets.

View goodhamgupta's full-sized avatar
💻

Shubham Gupta goodhamgupta

💻
View GitHub Profile
@goodhamgupta
goodhamgupta / cvrptw_mixed_pd.py
Created December 8, 2022 00:58
CVRPTW with Mixed Pickup and Delivery
from functools import partial
from ortools.constraint_solver import routing_enums_pb2, pywrapcp
def create_data_model():
# Dummy data
int_time_matrix = [[0, 15, 34, 29], [15, 0, 20, 14], [34, 20, 0, 7], [29, 14, 7, 0]] # In minutes
cur_distance_matrix = [[0, 11, 24, 20], [11, 0, 14, 10], [24, 14, 0, 5], [20, 10, 5, 0]] # In Kilometres
data['distance_matrix'] = cur_dist_matrix
data['time_matrix'] = int_time_matrix

Sockets

  • Two-sided communication links between two programs in a network.
  • Connection: Machines are aware of the each other's network location(IP) and TCP port
  • Can be TCP or UDP based.

Socket Types

Two kinds of sockets: Server(wait for request) and Client(receive and send data)

def generate(label):
(
bbox_xmin,
bbox_ymin,
bbox_xmax,
bbox_ymax,
img_width,
img_height
) = (
label.get('xmin'),
@goodhamgupta
goodhamgupta / yolo_to_voc.py
Last active January 24, 2024 12:05
Convert yolo coordinates to VOC format
# Script to convert yolo annotations to voc format
# Sample format
# <annotation>
# <folder>_image_fashion</folder>
# <filename>brooke-cagle-39574.jpg</filename>
# <size>
# <width>1200</width>
# <height>800</height>
# <depth>3</depth>