title: Attributeerror module 'torchvision.models.detection' has no attribute 'ssdlite320_mobilenet_v3_large'
body: <p>I had executed object detection using Deep Neural Network which is SSD with backbone of MobilenetV3 on raspberry pi 4B, but it turns out this error &quot;Attributeerror module 'torchvision.models.detection' has no attribute 'ssdlite320_mobilenet_v3_large'&quot;.</p>
  <p>The following is the specifications of my experiment:</p>
  <pre><code>model = SSD with mobilenetV3
  library = pyTorch
  torch = 1.7.1
  torchvision = 0.8.2
  device = raspberry pi 4B (ArmV8)
  </code></pre>
  <p>Here is my script:</p>
  <pre><code># import the necessary packages
  from torchvision.models import detection, mobilenet
  from imutils.video import VideoStream
  from imutils.video import FPS
  import numpy as np
  import argparse
  import imutils
  import pickle
  import torch
  import time
  import cv2
  
  import paramiko
  import psutil
  import GPUtil
  import datetime 
  import mysql.connector
  
  import ftplib
  import pysftp
  
  mydb = mysql.connector.connect(
    host=&quot;aaa&quot;,
    user=&quot;bbb&quot;,
    password=&quot;ccc!&quot;,
    database=&quot;ddd&quot;
  )
  mycursor = mydb.cursor()
  
  
  labels = 'pytorch/labels/coco_classes.pickle'
  # class_name = 'pytorch/labels/coco.names'
  # model = 'frcnn-mobilenet'
  # model = 'frcnn-resnet'
  # model = 'mrcnn-resnet'
  # model = 'retinanet'
  model = 'ssd-mobilenet'
  # model = 'ssd-vgg16'
  confidence_param = 0.5
  
  
  
  DEVICE = torch.device(&quot;cuda&quot; if torch.cuda.is_available() else &quot;cpu&quot;)
  CLASSES = pickle.loads(open(labels, &quot;rb&quot;).read())
  COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3))
  
  MODELS = {
      &quot;frcnn-resnet&quot;: detection.fasterrcnn_resnet50_fpn,
      &quot;frcnn-mobilenet&quot;: detection.fasterrcnn_mobilenet_v3_large_320_fpn,
      &quot;retinanet&quot;: detection.retinanet_resnet50_fpn,
      &quot;ssd-mobilenet&quot;: detection.ssdlite320_mobilenet_v3_large,
      &quot;ssd-vgg16&quot;: detection.ssd300_vgg16,
      &quot;mrcnn-resnet&quot;: detection.maskrcnn_resnet50_fpn    
  }
  
  # load the model and set it to evaluation mode
  print(&quot;[INFO] loading model...&quot;)
  model = MODELS[model](pretrained=True, progress=True, num_classes=len(CLASSES), pretrained_backbone=True).to(DEVICE)
  modelsum = model.eval()
  
  print(&quot;[INFO] starting video stream...&quot;)
  vs = VideoStream(src=0).start()
  fps = FPS().start() 
  
  # auto stop when timeout
  time.sleep(2.0)
  timeout = time.time() + 10
  pTime = 0
  cTime = 0
  current_time = datetime.datetime.now() 
  
  # loop over the frames from the video stream
  while True:
      cTime = time.time()
      frame = vs.read()
      frame = imutils.resize(frame, width=600)
      orig = frame.copy()
      frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
      frame = frame.transpose((2, 0, 1))
      frame = np.expand_dims(frame, axis=0)
      frame = frame / 255.0
      frame = torch.FloatTensor(frame)
  
      frame = frame.to(DEVICE)
      detections = model(frame)[0]
  
      # gpu configuration
      GPUs = GPUtil.getGPUs()
      gpu = GPUs[0]
      gpu1 = gpu.load * 100
      cpu2 = psutil.cpu_percent() + 10
      ram1 = psutil.virtual_memory()[2]
  
      cpu3 = '{:.2f}'.format(cpu2)
      gpu2 = '{:.2f}'.format(gpu1)
      print ('')
      print ('---------------------------------')
      print ('cpu usage: ', cpu3, '%')
      print ('gpu usage: ', gpu2, '%')
      ram1 = psutil.virtual_memory()[2]
      print('RAM: ', ram1, '%')
  
      # loop over the detections
      for i in range(0, len(detections[&quot;boxes&quot;])):
          
          confidence = detections[&quot;scores&quot;][i]
          idx = int(detections[&quot;labels&quot;][i])
  
          if idx == 1 and confidence &gt; confidence_param:
              print ('---object has been detected!---')
  
              box = detections[&quot;boxes&quot;][i].detach().cpu().numpy()
              (startX, startY, endX, endY) = box.astype(&quot;int&quot;)
  
              label = &quot;{}: {:.2f}%&quot;.format(CLASSES[idx], confidence * 100)
              cv2.rectangle(orig, (startX, startY), (endX, endY), COLORS[idx], 2)
              accuracy = label
              
              
  
              y = startY - 15 if startY - 15 &gt; 15 else startY + 15
              cv2.putText(orig, label, (startX, y),cv2.FONT_HERSHEY_SIMPLEX, 0.5, COLORS[idx], 2)
              
              s1 = cTime-pTime
              s2 = '{:.2f}'.format(s1)
              fps1 = 1/(cTime-pTime)
              fps2 = '{:.2f}'.format(fps1)
              
              pTime = cTime
              
              print (&quot;bounding box: &quot;, startX, startY, endX, endY)
  
              startXa = int(startX)
              startYa = int(startY)
              endXa = int(endX)
              endYa = int(endY)
  
              try:
                  xid = mycursor.lastrowid
                  print('Record ID: ', xid)
                  xid += 1
              except:
                  pass
  
              print ('Throughput rate: ', fps2,&quot;fps&quot;)
              print ('---------------------------------')
              print ('')
  
  
              break
  
          else:
              
              print ('---NO object has been detected---')
            
              s1 = cTime-pTime
              s2 = '{:.2f}'.format(s1)
  
              fps1 = 1/(cTime-pTime)
              fps2 = '{:.2f}'.format(fps1)
              
              pTime = cTime
              
              try:
                  xid = mycursor.lastrowid
                  print('Record ID: ', xid)
                  xid += 1
              except:
                  pass
  
              print ('Throughput rate: ', fps2,&quot;fps&quot;)
              print ('---------------------------------')
              print ('')
  
  
            
  
              break
  
      cv2.imshow(&quot;Frame&quot;, orig)
      key = cv2.waitKey(1) &amp; 0xFF
  
      if time.time() &gt; timeout:
          break
  
      if key == ord(&quot;q&quot;):
          break
  
  
      fps.update()
  
    
  
  # stop the timer and display FPS information
  fps.stop()
  print(&quot;[INFO] elapsed time: {:.2f}&quot;.format(fps.elapsed()))
  print(&quot;[INFO] approx. FPS: {:.2f}&quot;.format(fps.fps()))
  
  cv2.destroyAllWindows()
  vs.stop()
  </code></pre>