<jupyter_start><jupyter_text>Application Goal : Multi Class classification quick mode with DenseNet169  Setup Monk  Download Monk<jupyter_code>!git clone https://github.com/Tessellate-Imaging/monk_v1<jupyter_output><empty_output><jupyter_text>Setup dependencies<jupyter_code>cd monk_v1
!pip install -r installation/requirements_cu10.txt<jupyter_output><empty_output><jupyter_text>Import Monk<jupyter_code>import os
import sys
sys.path.append("./monk_v1/monk");
import psutil
from pytorch_prototype import prototype<jupyter_output><empty_output><jupyter_text>Prepare Dataset  Download Dataset<jupyter_code>!wget https://www.dropbox.com/s/b5zk60m8l9wnpc4/LEGO.zip<jupyter_output><empty_output><jupyter_text>Extract Dataset<jupyter_code>!unzip LEGO.zip<jupyter_output><empty_output><jupyter_text>Vanilla Training  Create experiment<jupyter_code>ptf = prototype(verbose=1);
ptf.Prototype("Lego_Classification", "exp-1");<jupyter_output><empty_output><jupyter_text>List Models to Choose from<jupyter_code>#ptf.List_Models()<jupyter_output><empty_output><jupyter_text>Load Dataset<jupyter_code>ptf.Default(dataset_path=["./LEGO/train","./LEGO/valid"], model_name="densenet169", freeze_base_network=True, num_epochs=4)
ptf.Summary()<jupyter_output><empty_output><jupyter_text>Train<jupyter_code>ptf.Train()<jupyter_output><empty_output><jupyter_text>Inference  Get the image<jupyter_code>import requests
test_url = "https://img.brickowl.com/files/image_cache/larger/lego-blue-brick-2-x-3-3002-30-462227-39.jpg"

# URL of the image to be downloaded is defined as image_url 
r = requests.get(test_url) # create HTTP response object 
with open('test.jpg','wb') as f: 
    f.write(r.content)<jupyter_output><empty_output><jupyter_text>Set experiment to Inference<jupyter_code>ptf.Prototype("LEGO", "exp-1", eval_infer=True);<jupyter_output><empty_output><jupyter_text>Run predictions<jupyter_code>img_name = "test.jpg";
predictions = ptf.Infer(img_name=img_name, return_raw=True);
print(predictions)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12438057482656095, 'fraction_numerical': 0.018334985133795837, 'mean_word_length': 10.60344827586207, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '157463', 'license': 'Apache-2.0', 'n_tokens_mistral': 798, 'n_tokens_neox': 774, 'n_words': 92, 'path': 'tutorials/2_Lego_Classification(Pytorch).ipynb', 'repo_name': 'gstearmit/monk_v1', 'size': '2018'}