Fixed darknet.py - uses batch=1 by default
| | |
| | | load_net.argtypes = [c_char_p, c_char_p, c_int] |
| | | load_net.restype = c_void_p |
| | | |
| | | load_net_custom = lib.load_network_custom |
| | | load_net_custom.argtypes = [c_char_p, c_char_p, c_int, c_int] |
| | | load_net_custom.restype = c_void_p |
| | | |
| | | do_nms_obj = lib.do_nms_obj |
| | | do_nms_obj.argtypes = [POINTER(DETECTION), c_int, c_int, c_float] |
| | | |
| | |
| | | if not os.path.exists(metaPath): |
| | | raise ValueError("Invalid data file path `"+os.path.abspath(metaPath)+"`") |
| | | if netMain is None: |
| | | netMain = load_net(configPath.encode("ascii"), weightPath.encode("ascii"), 0) |
| | | netMain = load_net_custom(configPath.encode("ascii"), weightPath.encode("ascii"), 0, 1) # batch size = 1 |
| | | if metaMain is None: |
| | | metaMain = load_meta(metaPath.encode("ascii")) |
| | | if altNames is None: |
| | |
| | | C:\Python27\python.exe darknet.py |
| | | |
| | | |
| | | |
| | | rem Python 3.6 |
| | | rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install numpy |
| | | rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install scikit-image |
| | | rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\Scripts\pip install scipy |
| | | |
| | | rem C:\Users\Alex\AppData\Local\Programs\Python\Python36\python.exe darknet.py |
| | | |
| | | pause |
| | |
| | | load_net.argtypes = [c_char_p, c_char_p, c_int] |
| | | load_net.restype = c_void_p |
| | | |
| | | load_net_custom = lib.load_network_custom |
| | | load_net_custom.argtypes = [c_char_p, c_char_p, c_int, c_int] |
| | | load_net_custom.restype = c_void_p |
| | | |
| | | do_nms_obj = lib.do_nms_obj |
| | | do_nms_obj.argtypes = [POINTER(DETECTION), c_int, c_int, c_float] |
| | | |
| | |
| | | if not os.path.exists(metaPath): |
| | | raise ValueError("Invalid data file path `"+os.path.abspath(metaPath)+"`") |
| | | if netMain is None: |
| | | netMain = load_net(configPath.encode("ascii"), weightPath.encode("ascii"), 0) |
| | | netMain = load_net_custom(configPath.encode("ascii"), weightPath.encode("ascii"), 0, 1) # batch size = 1 |
| | | if metaMain is None: |
| | | metaMain = load_meta(metaPath.encode("ascii")) |
| | | if altNames is None: |
| | |
| | | { |
| | | box_label *boxes = calloc(1, sizeof(box_label)); |
| | | FILE *file = fopen(filename, "r"); |
| | | if(!file) file_error(filename); |
| | | if (!file) { |
| | | printf("Can't open label file. \n"); |
| | | file_error(filename); |
| | | } |
| | | float x, y, h, w; |
| | | int id; |
| | | int count = 0; |
| | |
| | | #include "yolo_layer.h" |
| | | #include "parser.h" |
| | | |
| | | network *load_network(char *cfg, char *weights, int clear) |
| | | network *load_network_custom(char *cfg, char *weights, int clear, int batch) |
| | | { |
| | | printf(" Try to load cfg: %s, weights: %s, clear = %d \n", cfg, weights, clear); |
| | | network *net = calloc(1, sizeof(network)); |
| | | *net = parse_network_cfg(cfg); |
| | | *net = parse_network_cfg_custom(cfg, batch); |
| | | if (weights && weights[0] != 0) { |
| | | load_weights(net, weights); |
| | | } |
| | |
| | | return net; |
| | | } |
| | | |
| | | network *load_network(char *cfg, char *weights, int clear) |
| | | { |
| | | return load_network_custom(cfg, weights, clear, 0); |
| | | } |
| | | |
| | | int get_current_batch(network net) |
| | | { |
| | | int batch_num = (*net.seen)/(net.batch*net.subdivisions); |
| | |
| | | YOLODLL_API detection *make_network_boxes(network *net, float thresh, int *num); |
| | | YOLODLL_API void free_detections(detection *dets, int n); |
| | | YOLODLL_API void reset_rnn(network *net); |
| | | YOLODLL_API network *load_network_custom(char *cfg, char *weights, int clear, int batch); |
| | | YOLODLL_API network *load_network(char *cfg, char *weights, int clear); |
| | | YOLODLL_API float *network_predict_image(network *net, image im); |
| | | YOLODLL_API void train_detector(char *datacfg, char *cfgfile, char *weightfile, int *gpus, int ngpus, int clear, int dont_show); |