<jupyter_start><jupyter_text>Installation - Run these commands          - git clone https://github.com/Tessellate-Imaging/Monk_Object_Detection.git          - cd Monk_Object_Detection/8_pytorch_rfbnet/installation      - Select the right requirements file and run      - chmod +x install.sh          - ./install.sh  About the network1. Paper on RBFNet: https://arxiv.org/abs/1711.077672. Blog 1 on Receptive field: http://blog.christianperone.com/2017/11/the-effective-receptive-field-on-cnns/3. Blog 2 on Receptive field: http://www.cs.toronto.edu/~wenjie/papers/nips16/top.pdf  COCO Dataset Directory Structure    ../sample_dataset (root_dir)          |          |------kangaroo (coco_dir)           |         |          |         |----images (set_dir)          |                |          |                |---------img1.jpg          |                |---------img2.jpg          |                |---------..........(and so on)           |          |          |         |---annotations           |         |----|          |              |--------------------instances_Train.json  (instances_.json)          |              |--------------------classes.txt                     - instances_Train.json -> In proper COCO format - classes.txt          -> A list of classes in alphabetical order For TrainSet - root_dir = "../sample_dataset"; - coco_dir = "kangaroo"; - set_dir = "Images"; Note: Annotation file name too coincides against the set_dir  Sample Dataset Credits    credits: https://github.com/experiencor/kangaroo<jupyter_code>import os
import sys
sys.path.append("../../8_pytorch_rfbnet/lib/");
from train_detector import Detector
gtf = Detector();
#USing training set structured in format 1
root_dir = "../sample_dataset";
coco_dir = "kangaroo";
set_dir = "Images";
#300
#512 - not supported for mobilenet
gtf.Train_Dataset(root_dir, coco_dir, set_dir, batch_size=4,image_size=300, num_workers=3)
#vgg - 300, 512
#e_vgg - 300, 512
#mobilenet - 300, 512
gtf.Model(model_name="mobilenet", use_gpu=True, ngpu=1);
gtf.Set_HyperParams(lr=0.0001, momentum=0.9, weight_decay=0.0005, gamma=0.1, jaccard_threshold=0.5)
gtf.Train(epochs=10, log_iters=True, output_weights_dir="weights", saved_epoch_interval=10);<jupyter_output>Loading base network...
Initializing weights...
Loading Dataset...
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
../sample_dataset_kangaroo_Images gt roidb loaded from /home/abhi/Desktop/Work/tess_tool/gui/v0.3/obj_det_models/Organization/v0.10_rfbnet/example_notebooks/8_pytorch_rfbnet/coco_cache/../sample_dataset_kangaroo_Images_gt_roidb.pkl
Training RFB_mobile on COCO<jupyter_text>Inference<jupyter_code>import os
import sys
sys.path.append("../../8_pytorch_rfbnet/lib/");
from infer_detector import Infer
gtf = Infer();
gtf.Model(model_name="mobilenet", weights="weights/Final_RFB_mobile_COCO.pth", use_gpu=True)
class_file = "../sample_dataset/kangaroo/annotations/classes.txt"
gtf.Image_Params(class_file, input_size=300)
gtf.Setup();
img_path = "../sample_dataset/kangaroo/test/kg1.jpeg";
output = gtf.Predict(img_path, thresh=0.5, font_size=1, line_size=3)
from IPython.display import Image
Image(filename='output.png')
img_path = "../sample_dataset/kangaroo/test/kg3.jpeg";
output = gtf.Predict(img_path, thresh=0.6, font_size=1, line_size=3)
from IPython.display import Image
Image(filename='output.png')<jupyter_output>1 1
{'fraction_non_alphanumeric': 0.14613349014995589, 'fraction_numerical': 0.02999117906498089, 'mean_word_length': 2.9329479768786126, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '335902', 'license': 'Apache-2.0', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1141, 'n_words': 217, 'path': 'example_notebooks/8_pytorch_rfbnet/Train and Infer - Mobilenet.ipynb', 'repo_name': 'jayeshk7/Monk_Object_Detection', 'size': '3401'}