- [Connect][ec2-connect] to the EC2 instance.
- Update package manager to be able to find s3fs:
sudo apt-get update
- Install s3fs and awscli:
sudo apt install s3fs awscli -y
which s3fs /usr/bin/s3fs
- Setup access(if you do NOT have credentials please check the [Give permission to EC2 to access S3][permission] section below ):
This file contains hidden or 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 copy | |
import logging | |
import numpy as np | |
import torch | |
from PIL import Image, ImageDraw | |
from detectron2.data import MetadataCatalog | |
from detectron2.evaluation import DatasetEvaluator | |
from detectron2.structures import Instances | |
from detectron2.utils import comm |
This file contains hidden or 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
@ROI_MASK_HEAD_REGISTRY.register() | |
class CustomMaskRCNNConvUpsampleHead(MaskRCNNConvUpsampleHead): | |
@configurable | |
def __init__(self, input_shape: ShapeSpec, *, num_classes, conv_dims, conv_norm="", **kwargs): | |
super().__init__(input_shape, num_classes=num_classes, conv_dims=conv_dims, conv_norm=conv_norm, **kwargs) | |
self.vis_period = 0 |
This file contains hidden or 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
logger.info("Starting training from iteration {}".format(start_iter)) | |
with EventStorage(start_iter) as storage: | |
previous_val_map = 0 # ADDED NEW | |
no_improvement_for_epochs = 0 # ADDED NEW | |
for data, iteration in zip(data_loader, range(start_iter, max_iter)): | |
storage.iter = iteration | |
... | |
if ( | |
cfg.TEST.EVAL_PERIOD > 0 | |
and (iteration + 1) % cfg.TEST.EVAL_PERIOD == 0 |
This file contains hidden or 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
# Only 'ADDED NEW' commented statements are added for validation loss calculation. | |
validation_data_loader = prepare_validation_loader(cfg) # ADDED NEW | |
logger.info("Starting training from iteration {}".format(start_iter)) | |
with EventStorage(start_iter) as storage: | |
for data, iteration in zip(data_loader, range(start_iter, max_iter)): | |
storage.iter = iteration | |
loss_dict = model(data) | |
losses = sum(loss_dict.values()) |
This file contains hidden or 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
def calculate_validation_loss(validation_dataset_loader, model, storage): | |
data = next(validation_dataset_loader) | |
with torch.no_grad(): | |
loss_dict = model(data) | |
losses = sum(loss_dict.values()) | |
assert torch.isfinite(losses).all(), loss_dict | |
loss_dict_reduced = {"val_" + k: v.item() for k, v in | |
comm.reduce_dict(loss_dict).items()} |
This file contains hidden or 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
def prepare_validation_loader(cfg): | |
val_cfg = cfg.clone() | |
val_cfg.defrost() | |
val_cfg.DATASETS.TRAIN = val_cfg.DATASETS.TEST | |
val_cfg.freeze() | |
val_mapper = DatasetMapper(val_cfg, True, augmentations=[]) | |
return iter(build_detection_train_loader(val_cfg, mapper=val_mapper)) |
This file contains hidden or 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
#!/bin/bash | |
# Usage | |
# Make install_kafka.sh and check_consumers.sh executable via `chmod +x _file_`. | |
# Then, run the script: | |
# ./check_consumers.sh -g 'consumer.group.retry' -b 'localhost:9092,localhost:9093' | |
while getopts g:b: flag | |
do |
This file contains hidden or 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
"use strict"; | |
const ImageData = require("./ImageData"); | |
const ImageConverterOperator = require("./ImageConverterOperator"); | |
const gm = require("gm").subClass({imageMagick: true}) | |
/** | |
* Get enable to use memory size in ImageMagick | |
* Typically we determine to us 90% of max memory size | |
* @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-environment-variables.html |
This file contains hidden or 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
Angerer Timo: 12.7, Baumann Maximilian: 12.7, Botos Arpad: 12.7, Cankaya Faruk: 12.7, Cervieri Carrau Valentin: 12.7, Chen Junpeng: 12.7, Coffey Aubrey: 12.7, Coutinho Manuel: 12.7, Dalkilic Sinem: 12.7, Danner Katharina: 12.7, Derkacz-Bogner Daniel: 12.7, Eberhard Eike: 12.7, Egawa Mayumi: 12.7, Elfering Felix: 12.7, Flesch Lukas: 12.7, Frank Fabian: 12.7, Frings Andreas: 12.7, Fritsch Jonas: 12.7, Fuchsloch Leonardo: 12.7, Gedik Erenay: 12.7, Germes Tanae: 12.7, Ginter Pascal: 12.7, Gräßle Sarah: 12.7, Gu Yiyu: 12.7, Guan Haowen: 12.7, Guerrero Gutierrez Victor Hugo: 12.7, Gültekin Bora: 12.7, Guo Mingxiao: 12.7, Hakobyan Astghik: 12.7, Hamdy Hoda: 12.7, Harlander Julia: 12.7, Hekim David: 12.7, Hlubek Kamil: 12.7, Holzner Andreas: 12.7, Hontheim Henning: 12.7, Huber Lukas: 12.7, Hug Michael: 12.7, Iyidogan Atacan: 12.7, Izrailevitch Valentina: 12.7, Johler Marc: 12.7, Karabulut Erkan: 12.7, Karali Fatma: 12.7, Kim Hyunsung: 12.7, Kiray Mert: 12.7, Köbele Till: 12.7, Kobiella Robert: 12.7, Kolb Katharina: 1 |