<jupyter_start><jupyter_text>Camera  Task<jupyter_code>#import torchvision.transforms as transforms

TASK = 'object_behavior'
CATEGORIES = ['background1','redlight','greenlight','bottle']
DATASETS = ['A']

import torch
import torchvision

#device = torch.device('cuda')
output_dim = len(CATEGORIES)  #number of categories

# RESNET 18
model_class = torchvision.models.resnet18(pretrained=False)
model_class.fc = torch.nn.Linear(512, output_dim)
model_class = model_class.cuda().eval().half()
#model_class = model_class.to(device)

model_class.load_state_dict(torch.load('classification_behavior_model.pth'))



from torch2trt import torch2trt

data = torch.zeros((1, 3, 224, 224)).cuda().half()

model_trt = torch2trt(model_class, [data], fp16_mode=True)
torch.save(model_trt.state_dict(), 'trt_classification_behavior_model.pth')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13488372093023257, 'fraction_numerical': 0.02441860465116279, 'mean_word_length': 8.258064516129032, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '632024', 'license': 'MIT', 'n_tokens_mistral': 332, 'n_tokens_neox': 312, 'n_words': 49, 'path': 'Classification_Stop_at_RoadFollowing/.ipynb_checkpoints/2_load_build_2_TRT_classification_model-checkpoint.ipynb', 'repo_name': 'tomMEM/Jetbot-Project', 'size': '860'}