<jupyter_start><jupyter_text>Please check if CUDA on your device is available.<jupyter_code>import torch
print(torch.__version__)
print(torch.cuda.is_available())
%load_ext autoreload
%autoreload 2
import os
import torch as t
from utils.config import opt
from model import FasterRCNNVGG16
from trainer import FasterRCNNTrainer
from data.util import  read_image
from utils.vis_tool import vis_bbox
from utils import array_tool as at
from train import train
from Test import test
%matplotlib inline<jupyter_output><empty_output><jupyter_text>To use Visdom, please run the codes below in cmd and visit http://localhost:8097 in your browser.python -m visdom.server If you'd like to train for a new one, set **load_path** = None in utils/config.py<jupyter_code>train()<jupyter_output><empty_output><jupyter_text>You'll need to download pretrained model from [BaiduDisk](https://pan.baidu.com/s/12NLSy-7zsNpuYNoeJjj_wA) with password：<PASSWORD><jupyter_code>test()<jupyter_output><empty_output><jupyter_text>Following is a sample to show a demo of some images.<jupyter_code>faster_rcnn = FasterRCNNVGG16()
trainer = FasterRCNNTrainer(faster_rcnn).cuda()
trainer.load(opt.load_path)
demo_path = 'demo'
img_list = os.listdir(demo_path)
imgs = list()
for filename in img_list:
    img = read_image(demo_path + '/' + filename, color=True)
    img = t.from_numpy(img)
    imgs.append(img)
_bboxes, _labels, _scores = trainer.faster_rcnn.predict(imgs, visualize=True)
# print(_bboxes, _labels, _scores)
for i in range(len(imgs)):
    vis_bbox(at.tonumpy(imgs[i]),
            at.tonumpy(_bboxes[i]),
            at.tonumpy(_labels[i]).reshape(-1),
            at.tonumpy(_scores[i]).reshape(-1))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10480602200347423, 'fraction_numerical': 0.008106543138390272, 'mean_word_length': 5.545454545454546, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '392649', 'license': 'MIT', 'n_tokens_mistral': 625, 'n_tokens_neox': 616, 'n_words': 145, 'path': 'Demo_pro.ipynb', 'repo_name': 'IT-BillDeng/Garbage-Classification', 'size': '1721'}