Esempio n. 1
0
def really_commands(mode):
    modules = utils.get_classes('workflow.{0}'.format(mode))
    for module in modules:
        # get RCE if you can edit general file in workflow folder :)
        module_name = module[0].strip()
        module_object = eval('{0}.{1}'.format(mode, module_name))
        # parsing commands
        try:
            routines = module_object.commands
        except:
            continue
        for routine, commands in routines.items():
            for command in commands:
                item = command
                item['mode'] = mode
                item['speed'] = routine
                item['module'] = module_name
                item['alias'] = module_name + "__" + routine.lower() + "__" + \
                    str(item.get('banner')).lower()
                Commands.objects.create(**item)

        reports = module_object.reports
        parse_report(reports, module_name, mode)
Esempio n. 2
0
#   File name   : nms_demo.py
#   Author      : YunYang1994
#   Created date: 2018-11-27 13:02:17
#   Description :
#
#================================================================

import time
import numpy as np
import tensorflow as tf
from PIL import Image
from core import utils

SIZE = [416, 416]
# SIZE = [608, 608]
classes = utils.get_classes('./data/coco.names')
num_classes = len(classes)
img = Image.open('./data/demo_data/611.jpg')
img_resized = np.array(img.resize(size=tuple(SIZE)), dtype=np.float32)
img_resized = img_resized / 255.
cpu_nms_graph, gpu_nms_graph = tf.Graph(), tf.Graph()

# nms on GPU
input_tensor, output_tensors = utils.read_pb_return_tensors(
    gpu_nms_graph, "./checkpoint/yolov3_gpu_nms.pb",
    ["Placeholder:0", "concat_10:0", "concat_11:0", "concat_12:0"])
with tf.Session(graph=gpu_nms_graph) as sess:
    for i in range(5):
        start = time.time()
        boxes, scores, labels = sess.run(
            output_tensors,
Esempio n. 3
0
config.gpu_options.allocator_type = 'BFC'  # A "Best-fit with coalescing" algorithm, simplified from a version of dlmalloc.
config.gpu_options.per_process_gpu_memory_fraction = 0.8
config.gpu_options.allow_growth = True
set_session(tf.Session(config=config))

if __name__ == "__main__":
    # 训练后的模型保存路径
    log_dir = os.path.join(cfg.PATH.logs, 'v4')
    # 权值文件
    weights_path = cfg.PATH.weight_path
    # 输入的shape大小
    input_shape = cfg.TRAIN.input_size
    # 是否对损失进行归一化
    normalize = True
    # 获取classes和anchor
    class_names = get_classes(cfg.PATH.classes_info)
    anchors = get_anchors(cfg.PATH.anchors_info)
    # 一共有多少类和多少先验框
    num_classes = len(class_names)
    num_anchors = len(anchors)
    #------------------------------------------------------#
    #   Yolov4的tricks应用
    #   mosaic 马赛克数据增强 True or False
    #   实际测试时mosaic数据增强并不稳定,所以默认为False
    #   Cosine_scheduler 余弦退火学习率 True or False
    #   label_smoothing 标签平滑 0.01以下一般 如0.01、0.005
    #------------------------------------------------------#
    mosaic = False
    Cosine_scheduler = False
    label_smoothing = 0.005