class_docstr: This class tests the Detector Classifier.
class_docstr_tok: ["This","class","tests","the","Detector","Classifier","."]
code: def setUpClass(cls):
      super().setUpClass()
  
      cls.x_train_mnist = np.reshape(
          cls.x_train_mnist, (cls.x_train_mnist.shape[0], 1, 28, 28)
      ).astype(np.float32)
      cls.x_test_mnist = np.reshape(
          cls.x_test_mnist, (cls.x_test_mnist.shape[0], 1, 28, 28)
      ).astype(np.float32)
  
      # Define the internal classifier
      classifier = get_image_classifier_pt()
  
      # Define the internal detector
      conv = nn.Conv2d(1, 16, 5)
      linear = nn.Linear(2304, 1)
      torch.nn.init.xavier_uniform_(conv.weight)
      torch.nn.init.xavier_uniform_(linear.weight)
      model = nn.Sequential(
          conv, nn.ReLU(), nn.MaxPool2d(2, 2), Flatten(), linear
      )
      model = Model(model)
      loss_fn = nn.CrossEntropyLoss()
      optimizer = optim.Adam(model.parameters(), lr=0.01)
      detector = PyTorchClassifier(
          model=model,
          loss=loss_fn,
          optimizer=optimizer,
          input_shape=(1, 28, 28),
          nb_classes=2,
          clip_values=(0, 1),
      )
  
      # Define the detector-classifier
      cls.detector_classifier = DetectorClassifier(
          classifier=classifier, detector=detector
      )
  
      cls.x_train_mnist = np.reshape(
          cls.x_train_mnist, (cls.x_train_mnist.shape[0], 28, 28, 1)
      ).astype(np.float32)
      cls.x_test_mnist = np.reshape(
          cls.x_test_mnist, (cls.x_test_mnist.shape[0], 28, 28, 1)
      ).astype(np.float32)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import os
  import tempfile
  import logging
  import unittest
  import numpy
  import torch
  import torch.nn
  import torch.optim
  from art.estimators.classification.pytorch import PyTorchClassifier
  from art.estimators.classification.detector_classifier import DetectorClassifier
  from tests.utils import TestBase, get_image_classifier_pt
label_desc: Use image node_id 1 for calling the TestDetectorClassifier obj's underlying member method code with example usage: obj.setUpClass(cls) without return types