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
ptf = prototype(verbose=1); | |
ptf.Prototype("sample-project-1", "sample-experiment-1", resume_train=True); | |
ptf.Train() |
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 os | |
import sys | |
sys.path.append("./monk/") | |
import psutil | |
from pytorch_prototype import prototype | |
ptf = prototype(verbose=1); | |
ptf.Prototype("sample-project-1", "sample-experiment-1") | |
ptf.Default(dataset_path="./monk/datasets/train", model_name="resnet18", freeze_base_network=True, num_epochs=10) | |
ptf.Train() |
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
def final_block(pooling_branch_channels=32, pool_type="avg"): | |
network = [] | |
#Create subnetwork and add branches | |
subnetwork = [] | |
branch_1 = first_branch() | |
branch_2 = second_branch() | |
branch_3 = third_branch() | |
branch_4 = fourth_branch(pooling_branch_channels=pooling_branch_channels, | |
pool_type=pool_type) |
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
combined = [] | |
for i in tqdm(range(len(folders))): | |
files = os.listdir(anno_dir + "/" + folders[i]) | |
for j in range(len(files)): | |
fname = anno_dir + "/" + folders[i] + "/" + files[j] | |
f = open(fname, 'r') | |
lines = f.readlines() | |
f.close() | |
anno = [folders[i] + "/" + ".".join(files[j].split(".")[:-1])] | |
wr = "" |
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
list_dict = [] | |
anno = [] | |
for i in range(len(df)): | |
img_name = df[columns[0]][i] | |
labels = df[columns[1]][i] | |
tmp = labels.split(delimiter) | |
for j in range(len(tmp)//5): | |
label = tmp[j*5+4] | |
if(label not in anno): | |
anno.append(label) |
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
coco_data = {} | |
coco_data["type"] = "instances" | |
coco_data["images"] = [] | |
coco_data["annotations"] = [] | |
coco_data["categories"] = list_dict | |
image_id = 0 | |
annotation_id = 0 | |
for i in tqdm(range(len(df))): |
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 os | |
import sys | |
sys.path.append("../../4_efficientdet/lib/") | |
from train_detector import Detector | |
gtf = Detector() | |
gtf.Train_Dataset(root_dir, coco_dir, img_dir, set_dir, batch_size=8, image_size=512, use_gpu=True) | |
gtf.Model() | |
gtf.Set_Hyperparams(lr=0.0001, val_interval=1, es_min_delta=0.0, es_patience=0) | |
gtf.Train(num_epochs=30, model_output_dir="trained/") |
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
gtf = Detector() | |
gtf.Train_Dataset(root_dir, coco_dir, img_dir, set_dir, batch_size=16, use_gpu=True) | |
gtf.Model(model_name="resnet50", gpu_devices=[0, 1, 2, 3]) | |
gtf.Set_Hyperparams(lr=0.0001, val_interval=1, print_interval=20) | |
gtf.Train(num_epochs=10, output_model_name="final_model.pt") |
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
gtf = Infer() | |
gtf.Model(model_path="final_model.pt") | |
scores, labels, boxes = gtf.Predict(img_path, class_list, vis_threshold=0.2) |
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 os | |
import sys | |
sys.path.append("../../4_efficientdet/lib/") | |
from infer_detector import Infer | |
gtf = Infer() | |
gtf.Model(model_dir="trained/") | |
scores, labels, boxes = gtf.Predict(img_path, class_list, vis_threshold=0.4) |
OlderNewer