Intel® Celeron(R) CPU N3060 @ 1.60GHz × 2 で Caffe Object Detection コードのパフォーマンスを向上させるために Ray をインストールしました。次のエラーが発生します。
ioz@ioz-HP-Laptop-15-bs0xx:~/2019_07_13/CodeWrks$ python vel2.py
2019-08-31 18:56:48,743 WARNING worker.py:1373 -- WARNING: Not updating worker name since `setproctitle` is not installed. Install this with `pip install setproctitle` (or ray[debug]) to enable monitoring of worker processes.
2019-08-31 18:56:48,744 INFO node.py:498 -- Process STDOUT and STDERR is being redirected to /tmp/ray/session_2019-08-31_18-56-48_744086_5437/logs.
2019-08-31 18:56:48,874 INFO services.py:409 -- Waiting for redis server at 127.0.0.1:16018 to respond...
2019-08-31 18:56:49,011 INFO services.py:409 -- Waiting for redis server at 127.0.0.1:45059 to respond...
2019-08-31 18:56:49,029 INFO services.py:809 -- Starting Redis shard with 0.81 GB max memory.
2019-08-31 18:56:49,080 INFO node.py:512 -- Process STDOUT and STDERR is being redirected to /tmp/ray/session_2019-08-31_18-56-48_744086_5437/logs.
2019-08-31 18:56:49,082 WARNING services.py:1330 -- WARNING: The default object store size of 1.21 GB will use more than 50% of the available memory on this node (1.66 GB). Consider setting the object store memory manually to a smaller size to avoid memory contention with other applications.
2019-08-31 18:56:49,084 INFO services.py:1475 -- Starting the Plasma object store with 1.21 GB memory using /dev/shm.
Exception in thread Thread-8 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 1071, in run
File "/usr/lib/python2.7/threading.py", line 614, in wait
File "/usr/lib/python2.7/threading.py", line 364, in wait
<type 'exceptions.ValueError'>: list.remove(x): x not in list
Exception in thread Thread-7 (most likely raised during interpreter shutdown):
ioz@ioz-HP-Laptop-15-bs0xx:~/2019_07_13/CodeWrks$ python vel2.py
2019-08-31 18:56:54,792 WARNING worker.py:1373 -- WARNING: Not updating worker name since `setproctitle` is not installed. Install this with `pip install setproctitle` (or ray[debug]) to enable monitoring of worker processes.
2019-08-31 18:56:54,793 INFO node.py:498 -- Process STDOUT and STDERR is being redirected to /tmp/ray/session_2019-08-31_18-56-54_792936_5491/logs.
2019-08-31 18:56:54,920 INFO services.py:409 -- Waiting for redis server at 127.0.0.1:41843 to respond...
2019-08-31 18:56:55,074 INFO services.py:409 -- Waiting for redis server at 127.0.0.1:28148 to respond...
2019-08-31 18:56:55,083 INFO services.py:809 -- Starting Redis shard with 0.81 GB max memory.
2019-08-31 18:56:55,136 INFO node.py:512 -- Process STDOUT and STDERR is being redirected to /tmp/ray/session_2019-08-31_18-56-54_792936_5491/logs.
2019-08-31 18:56:55,138 WARNING services.py:1330 -- WARNING: The default object store size of 1.21 GB will use more than 50% of the available memory on this node (1.65 GB). Consider setting the object store memory manually to a smaller size to avoid memory contention with other applications.
2019-08-31 18:56:55,139 INFO services.py:1475 -- Starting the Plasma object store with 1.21 GB memory using /dev/shm.
2 つの異なる出力が得られるため、何も試していません。コードスニペットを見つけてください
import numpy as np
from imutils.video import WebcamVideoStream
from imutils.video import FPS
import argparse
import imutils
# import schedule
import sys
import datetime
import argparse
import logging
import os
import requests
import sched
import requests_cache
import time
from datetime import date
from datetime import timedelta
from imutils import contours
from skimage import measure
from threading import Thread
import json
import ray
ray.init() // Ray
initialized
requests_cache.install_cache('api_cache', backend='memory', expire_after=180)
try:
import cv2 as cv
except ImportError:
raise ImportError('Can\'t find OpenCV Python module. If you\'ve built it from sources without installation, '
'configure environemnt variable PYTHONPATH to "opencv_build_dir/lib" directory (with "python3" subdirectory if required)')
@ray.remote
def Zoom(cv2Object, zoomSize):
# Resizes the image/video frame to the specified amount of "zoomSize".
# A zoomSize of "2", for example, will double the canvas size
cv2Object = imutils.resize(cv2Object, width=(zoomSize * cv2Object.shape[1]))
# center is simply half of the height & width (y/2,x/2)
center = (cv2Object.shape[0] / 2, cv2Object.shape[1] / 2)
# cropScale represents the top left corner of the cropped frame (y/x)
cropScale = (center[0] / zoomSize, center[1] / zoomSize)
# The image/video frame is cropped to the center with a size of the original picture
# image[y1:y2,x1:x2] is used to iterate and grab a portion of an image
# (y1,x1) is the top left corner and (y2,x1) is the bottom right corner of new cropped frame.
# cv2Object = cv2Object[cropScale[0]:(center[0] + cropScale[0]), cropScale[1]:(center[1] + cropScale[1])]
return cv2Object
@ray.remote
def sr():
try:
smsCount = 0
inWidth = 600
inHeight = 600
WHRatio = inWidth / float(inHeight)
inScaleFactor = 0.007843
meanVal = 127.5
firstFrame = None
classNames = ('background',
'aeroplane', 'bicycle', 'bird', 'boat',
'bottle', 'bus', 'car', 'cat', 'chair',
'cow', 'diningtable', 'dog', 'horse',
'motorbike', 'person', 'pottedplant',
'sheep', 'sofa', 'train', 'tvmonitor')
parser = argparse.ArgumentParser()
parser.add_argument("--video", help="path to video file. If empty, camera's stream will be used")
parser.add_argument("--prototxt", default="MobileNetSSD_deploy.prototxt",
help="path to caffe prototxt")
parser.add_argument("-m", "--caffemodel", default="MobileNetSSD_deploy.caffemodel",
help="path to caffemodel file, download it here: "
"https://github.com/chuanqi305/MobileNet-SSD/")
parser.add_argument("--thr", default=0.5, help="confidence threshold to filter out weak detections")
args = parser.parse_args()
today = datetime.date.today()
todayerr = today.isoformat()
logging.basicConfig(level=logging.DEBUG, filename='exceptions_Cam01_' + str(todayerr) + '.txt')
num = 0
# fvs = VideoStream("rtsp://admin:Admin@123@192.168.1.14:554/cam/realmonitor?channel=7&subtype=0").start()
# fvs = VideoStream("rtsp://admin:admin12345@192.168.1.195:554/unicat/c3/s1/live").start()
saliency = None
with open('URL.txt', 'r') as fobj:
data = json.load(fobj)
r = requests.get(data['ClientUrl'])
res = json.loads(r.text)
fgbg = cv.bgsegm.createBackgroundSubtractorMOG()
for obj in res:
if obj.get('camera_id') == str(data['cam_id']):
print(obj.get('camera_url'))
fvs = WebcamVideoStream(0).start()
time.sleep(2.0)