<jupyter_start><jupyter_text>**Training**<jupyter_code>!darknet/darknet detector train custom_data/labelled_data.data darknet/cfg/yolov4-custom.cfg custom_weight/yolov4.conv.137 -dont_show
!darknet/darknet detector train custom_data/labelled_data.data darknet/cfg/yolov4-custom.cfg backup/yolov4-custom_last.weights -dont_show<jupyter_output>[1;30;43mStreaming output truncated to the last 5000 lines.[0m
 total_bbox = 1006275, rewritten_bbox = 0.101960 % 

 25962: 1.216318, 1.276790 avg loss, 0.001000 rate, 13.043616 seconds, 3323136 images, 0.722276 hours left
Loaded: 2.818450 seconds - performance bottleneck on CPU or Disk HDD/SSD
v3 (iou loss, Normalizer: (iou: 0.07, obj: 1.00, cls: 1.00) Region 139 Avg (IOU: 0.714915), count: 4, class_loss = 1.148285, iou_loss = 33.177666, total_loss = 34.325951 
v3 (iou loss, Normalizer: (iou: 0.07, obj: 1.00, cls: 1.00) Region 150 Avg (IOU: 0.901912), count: 4, class_loss = 0.815551, iou_loss = 3.136415, total_loss = 3.951966 
v3 (iou loss, Normalizer: (iou: 0.07, obj: 1.00, cls: 1.00) Region 161 Avg (IOU: 0.847697), count: 2, class_loss = 0.034384, iou_loss = 0.396773, total_loss = 0.431157 
 total_bbox = 1006285, rewritten_bbox = 0.101959 % 
v3 (iou loss, Normalizer: (iou: 0.07, obj: 1.00, cls: 1.00) Region 139 Avg (IOU: 0.819219), count: 5, class_loss = 0.877011, iou_loss = 34.48[...]<jupyter_text>**Detection**<jupyter_code>%cd /content/drive/MyDrive/juice_box/darknet/
# define helper functions
def imShow(path):
  import cv2
  import matplotlib.pyplot as plt
  %matplotlib inline

  image = cv2.imread(path)
  height, width = image.shape[:2]
  resized_image = cv2.resize(image,(3*width, 3*height), interpolation = cv2.INTER_CUBIC)
  fig = plt.gcf()
  fig.set_size_inches(10, 8)
  plt.axis("off")
  plt.imshow(cv2.cvtColor(resized_image, cv2.COLOR_BGR2RGB))
  plt.show()

# use this to upload files
def upload():
  from google.colab import files
  uploaded = files.upload() 
  for name, data in uploaded.items():
    with open(name, 'wb') as f:
      f.write(data)
      print ('saved file', name)

# use this to download a file  
def download(path):
  from google.colab import files
  files.download(path)
import os, subprocess
def run_bash(bashCommand):
  process = subprocess.Popen(bashCommand.split(),stdout=subprocess.PIPE)
  output,error = process.communicate()
from PIL import Image 
import PIL 
filepath = '/content/drive/MyDrive/yolo_custom_model_Training/custom_data/'
filepath_pred =  '/content/drive/MyDrive/juice_box/Pred_Image/'
for im in os.listdir(filepath):
  image_path = filepath + im
  run_bash("./darknet detector test /content/drive/MyDrive/juice_box/labelled_data.data /content/drive/MyDrive/juice_box/yolov4-test.cfg /content/drive/MyDrive/juice_box/backup/yolov4-custom_final.weights   /{0}".format(image_path))

  im1 = Image.open(r'predictions.jpg')
  new_name = filepath_pred + im
  im1 = im1.save(new_name)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12935153583617748, 'fraction_numerical': 0.09522184300341296, 'mean_word_length': 4.769685039370079, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '308190', 'license': 'MIT', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1132, 'n_words': 256, 'path': 'experiments/YOLOv4/Yolov4.ipynb', 'repo_name': 'moeraza/juice-box', 'size': '2930'}