From patchwork Mon Aug 2 08:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 13175 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6627ABD878 for ; Mon, 2 Aug 2021 08:21:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8CB1687B6; Mon, 2 Aug 2021 10:21:01 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="IE/7Wu/q"; dkim-atps=neutral Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 188576026E for ; Mon, 2 Aug 2021 10:20:59 +0200 (CEST) Received: by mail-wm1-x333.google.com with SMTP id l11-20020a7bcf0b0000b0290253545c2997so10457789wmg.4 for ; Mon, 02 Aug 2021 01:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WZlMS5FBBeGdetRL/PAGMMdWye+AZFtieM/Ae8ls3yU=; b=IE/7Wu/qo8REv89vQUKaAonDvRhELPoBohEbTBfM+v6laqSM7A/Jx6zHi1lYmzdbgZ OCR/mFJDq1xThm62xYDvqEjX+wNBv1s8CP/TwTwC2Bv3GuAdFEymltxWX4cerbVPyFM/ 2Mhg7NccRJGuOANKpI1y62YgJlTKIeheuNHyUvAZagOgy9i9K7WCLNYKZa+C8hoqhZEW X4UONy4sZz2I6uJcUqWT3dWHP90du/HP+mZWeFYSa2Hn/nOlECiZvNp1JbS9dYso805c 9eDhM/X9hkYup2PiAbfBjRP3LhE9E2RNuYsYMk5nTmDfJdlSHCxT+Ddqkbmvxudzx1Kw Yjew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WZlMS5FBBeGdetRL/PAGMMdWye+AZFtieM/Ae8ls3yU=; b=g9t57jo+gqpfdUWA4ohMYtQ35DCg77/nQ4BQXb4b4rqTC7r80aHDUm79MeMqBITtno T/7Ww/UJUa6dnoH+ftQiv1hQI0RtFkAulB2JP+V/m3/kw5iZj/UM+vYAkqAcn96fN5ro lrlM4kYe8uNsngRqiOizKc4uVDHGEh2OhI/6anJ/ITFfkWCCrBtwLPqB19ar5L211Xj9 +LE7oeK7reztesvTzuJ6sKnY/PatsuMPpNmLXqzQLyDAqD0N6iJqlvPhKPdhaE/PvGSx S73aff5x0rhWv2c9FZO2zhFL4lB8Aa6gcyyfXTrcc9RQUEWHVGXSzNUHgjqB+q5wH4+S mJ/A== X-Gm-Message-State: AOAM5308DcUUw5cemCDaYP/qdtEmDx+RnAgmK7lVn53l6oICX8UbFoSs FfQ0o94UMI20G6qFSZuDsaPkemgZdUtKLsGI X-Google-Smtp-Source: ABdhPJwpMf7smTTsPBI5GnTeIDDOHd/y4rOCVo8eFbnJcblh0OIvKGz7X/F4v/umOgAq9ggIC3QLxw== X-Received: by 2002:a1c:4e1a:: with SMTP id g26mr15166332wmh.52.1627892459387; Mon, 02 Aug 2021 01:20:59 -0700 (PDT) Received: from davidp-xps-13.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id h12sm10278430wrm.62.2021.08.02.01.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 01:20:59 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org, laurent.pinchart@ideasonboard.com Date: Mon, 2 Aug 2021 09:20:34 +0100 Message-Id: <20210802082034.6008-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210721115220.5090-2-david.plowman@raspberrypi.com> References: <20210721115220.5090-2-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 1/3] utils: raspberrypi: ctt: Fix namespace for sklearn NearestCentroid function X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The NearestCentroid function is in the sklearn.neighbors namespace since version 0.22. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham --- utils/raspberrypi/ctt/ctt_tools.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py index 48e0aac2..41c4efb6 100644 --- a/utils/raspberrypi/ctt/ctt_tools.py +++ b/utils/raspberrypi/ctt/ctt_tools.py @@ -14,7 +14,12 @@ import imutils import sys import matplotlib.pyplot as plt from sklearn import cluster as cluster -from sklearn.neighbors.nearest_centroid import NearestCentroid as get_centroids +try: + # From sklearn version 0.22 onwards, NearestCentroid is no longer in the + # nearest_centroid module + from sklearn.neighbors.nearest_centroid import NearestCentroid as get_centroids +except (ModuleNotFoundError): + from sklearn.neighbors import NearestCentroid as get_centroids """ This file contains some useful tools, the details of which aren't important to