001/* 002 * Copyright (C) Photon Vision. 003 * 004 * This program is free software: you can redistribute it and/or modify 005 * it under the terms of the GNU General Public License as published by 006 * the Free Software Foundation, either version 3 of the License, or 007 * (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU General Public License for more details. 013 * 014 * You should have received a copy of the GNU General Public License 015 * along with this program. If not, see <https://www.gnu.org/licenses/>. 016 */ 017 018package org.photonvision.vision.objects; 019 020import java.util.List; 021import org.opencv.core.Mat; 022import org.photonvision.vision.pipe.impl.NeuralNetworkPipeResult; 023 024/** 025 * A 'null' implementation of the {@link Model} and {@link ObjectDetector} interfaces. This is used 026 * when no model is available to load. 027 */ 028public class NullModel implements Model, ObjectDetector { 029 // Singleton instance 030 public static final NullModel INSTANCE = new NullModel(); 031 032 private NullModel() {} 033 034 public static NullModel getInstance() { 035 return INSTANCE; 036 } 037 038 @Override 039 public ObjectDetector load() { 040 return this; 041 } 042 043 @Override 044 public String getName() { 045 return "NullModel"; 046 } 047 048 @Override 049 public void release() { 050 // Do nothing 051 } 052 053 @Override 054 public Model getModel() { 055 return this; 056 } 057 058 @Override 059 public List<String> getClasses() { 060 return List.of(); 061 } 062 063 @Override 064 public List<NeuralNetworkPipeResult> detect(Mat in, double nmsThresh, double boxThresh) { 065 return List.of(); 066 } 067}