Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nbswords's full-sized avatar

nbswords

View GitHub Profile
@nbswords
nbswords / XGBoost vs LightGBM vs CatBoost.ipynb
Created January 21, 2021 09:48
XGBoost vs LightGBM vs CatBoost.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nbswords
nbswords / WIDER_FACE_covert_to_yolo.py
Last active June 26, 2021 00:24
WIDER_FACE_covert_to_yolo.py
import os
import shutil
import cv2
def convert(size, box):
dw = 1./size[0]
dh = 1./size[1]
x = (box[0] + box[1])/2.0
y = (box[2] + box[3])/2.0
w = box[1] - box[0]
import os
image_files = []
os.chdir(os.path.join("data", "obj"))
for filename in os.listdir(os.getcwd()):
if filename.endswith(".jpg"):
image_files.append("data/obj/" + filename)
os.chdir("..")
with open("train.txt", "w") as outfile:
for image in image_files:
import os
image_files = []
os.chdir(os.path.join("data", "test"))
for filename in os.listdir(os.getcwd()):
if filename.endswith(".jpg"):
image_files.append("data/test/" + filename)
os.chdir("..")
with open("test.txt", "w") as outfile:
for image in image_files: