{"id":13175,"url":"https://patchwork.libcamera.org/api/1.1/patches/13175/?format=json","web_url":"https://patchwork.libcamera.org/patch/13175/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210802082034.6008-1-david.plowman@raspberrypi.com>","date":"2021-08-02T08:20:34","name":"[libcamera-devel,v1,1/3] utils: raspberrypi: ctt: Fix namespace for sklearn NearestCentroid function","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"1a5b4abc8a2f7cf868a69dcb2ccf044a2ee75874","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13175/mbox/","series":[{"id":2294,"url":"https://patchwork.libcamera.org/api/1.1/series/2294/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2294","date":"2021-08-02T08:20:34","name":"[libcamera-devel,v1,1/3] utils: raspberrypi: ctt: Fix namespace for sklearn NearestCentroid function","version":1,"mbox":"https://patchwork.libcamera.org/series/2294/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13175/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13175/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6627ABD878\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  2 Aug 2021 08:21:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B8CB1687B6;\n\tMon,  2 Aug 2021 10:21:01 +0200 (CEST)","from mail-wm1-x333.google.com (mail-wm1-x333.google.com\n\t[IPv6:2a00:1450:4864:20::333])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 188576026E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Aug 2021 10:20:59 +0200 (CEST)","by mail-wm1-x333.google.com with SMTP id\n\tl11-20020a7bcf0b0000b0290253545c2997so10457789wmg.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 02 Aug 2021 01:20:59 -0700 (PDT)","from davidp-xps-13.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\th12sm10278430wrm.62.2021.08.02.01.20.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 02 Aug 2021 01:20:59 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"IE/7Wu/q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=WZlMS5FBBeGdetRL/PAGMMdWye+AZFtieM/Ae8ls3yU=;\n\tb=IE/7Wu/qo8REv89vQUKaAonDvRhELPoBohEbTBfM+v6laqSM7A/Jx6zHi1lYmzdbgZ\n\tOCR/mFJDq1xThm62xYDvqEjX+wNBv1s8CP/TwTwC2Bv3GuAdFEymltxWX4cerbVPyFM/\n\t2Mhg7NccRJGuOANKpI1y62YgJlTKIeheuNHyUvAZagOgy9i9K7WCLNYKZa+C8hoqhZEW\n\tX4UONy4sZz2I6uJcUqWT3dWHP90du/HP+mZWeFYSa2Hn/nOlECiZvNp1JbS9dYso805c\n\t9eDhM/X9hkYup2PiAbfBjRP3LhE9E2RNuYsYMk5nTmDfJdlSHCxT+Ddqkbmvxudzx1Kw\n\tYjew==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=WZlMS5FBBeGdetRL/PAGMMdWye+AZFtieM/Ae8ls3yU=;\n\tb=g9t57jo+gqpfdUWA4ohMYtQ35DCg77/nQ4BQXb4b4rqTC7r80aHDUm79MeMqBITtno\n\tT/7Ww/UJUa6dnoH+ftQiv1hQI0RtFkAulB2JP+V/m3/kw5iZj/UM+vYAkqAcn96fN5ro\n\tlrlM4kYe8uNsngRqiOizKc4uVDHGEh2OhI/6anJ/ITFfkWCCrBtwLPqB19ar5L211Xj9\n\t+LE7oeK7reztesvTzuJ6sKnY/PatsuMPpNmLXqzQLyDAqD0N6iJqlvPhKPdhaE/PvGSx\n\tS73aff5x0rhWv2c9FZO2zhFL4lB8Aa6gcyyfXTrcc9RQUEWHVGXSzNUHgjqB+q5wH4+S\n\tmJ/A==","X-Gm-Message-State":"AOAM5308DcUUw5cemCDaYP/qdtEmDx+RnAgmK7lVn53l6oICX8UbFoSs\n\tFfQ0o94UMI20G6qFSZuDsaPkemgZdUtKLsGI","X-Google-Smtp-Source":"ABdhPJwpMf7smTTsPBI5GnTeIDDOHd/y4rOCVo8eFbnJcblh0OIvKGz7X/F4v/umOgAq9ggIC3QLxw==","X-Received":"by 2002:a1c:4e1a:: with SMTP id\n\tg26mr15166332wmh.52.1627892459387; \n\tMon, 02 Aug 2021 01:20:59 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org,\n\tlaurent.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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 1/3] utils: raspberrypi: ctt: Fix\n\tnamespace for sklearn NearestCentroid function","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The NearestCentroid function is in the sklearn.neighbors namespace\nsince version 0.22.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\n utils/raspberrypi/ctt/ctt_tools.py | 7 ++++++-\n 1 file changed, 6 insertions(+), 1 deletion(-)","diff":"diff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py\nindex 48e0aac2..41c4efb6 100644\n--- a/utils/raspberrypi/ctt/ctt_tools.py\n+++ b/utils/raspberrypi/ctt/ctt_tools.py\n@@ -14,7 +14,12 @@ import imutils\n import sys\n import matplotlib.pyplot as plt\n from sklearn import cluster as cluster\n-from sklearn.neighbors.nearest_centroid import NearestCentroid as get_centroids\n+try:\n+    # From sklearn version 0.22 onwards, NearestCentroid is no longer in the\n+    # nearest_centroid module\n+    from sklearn.neighbors.nearest_centroid import NearestCentroid as get_centroids\n+except (ModuleNotFoundError):\n+    from sklearn.neighbors import NearestCentroid as get_centroids\n \n \"\"\"\n This file contains some useful tools, the details of which aren't important to\n","prefixes":["libcamera-devel","v1","1/3"]}