!git clone ololo
%pip install ./ololo
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 json | |
from os import listdir as ls, makedirs, path as osp | |
from tempfile import TemporaryDirectory | |
from zipfile import ZipFile | |
import pandas as pd | |
def merge_coco_archives(path_source, path_target=None, suffix='default'): |
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
from os import listdir as ls, makedirs, path as osp | |
from shutil import copy2 as cp, make_archive | |
from tempfile import TemporaryDirectory | |
def create_cvat_yolo_zip(path_source, path_classes=None, path_target=None, copy_images=False): | |
assert osp.isdir(path_source), f"'path_source' must be a directory with [flat] YOLO annotations!" | |
path_classes = path_classes or osp.join(path_source, 'classes.txt') | |
assert osp.isfile(path_classes), f"either 'path_classes' or 'classes.txt' in 'source_path' must exist!" | |
path_target = path_target or '.' |
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
# Evaluate function | |
def evaluate(env, agent, n_games=1, greedy=False, t_max=10000, frames=None): | |
""" Plays n_games full games. If greedy, picks actions as argmax(qvalues). Returns mean reward. """ | |
rewards = [] | |
render = isinstance(frames, list) | |
for _ in range(n_games): | |
s, _ = env.reset() | |
reward = 0 | |
for _ in range(t_max): |
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 com.github.valv.test | |
import kotlinx.serialization.* | |
import kotlinx.serialization.Serializable | |
import kotlinx.serialization.json.JSON | |
object Serializing { | |
@Serializable | |
data class SomeData(val name: String, val value: Any) |