Problem in send values to specifics channels


#1

I am having this problem

2018-03-16 15:00:01,013 deepsense.neptune.client_library.threads.channel_values_thread WARNING channel_values_thread.py:177 - _log_send_failure() Failed to send value to ‘w’ channel in x=1.0. X-coordinates must be strictly increasing for channel: 6a434156-d4d9-4f82-9d10-cc1415d2df5c. Invalid point: Point(1.0,Y(Some(108.0),None,None,None))
2018-03-16 15:00:01,013 deepsense.neptune.client_library.threads.channel_values_thread WARNING channel_values_thread.py:177 - _log_send_failure() Failed to send value to ‘w’ channel in x=1.0. X-coordinates must be strictly increasing for channel: 6a434156-d4d9-4f82-9d10-cc1415d2df5c. Invalid point: Point(1.0,Y(Some(108.0),None,None,None))

And the data don’t arrive to neptune, Anyone can help me ??

I am sending values with the code bellow:

ctx.channel_send(‘x’,int(bbox[0]))
ctx.channel_send(‘y’,int(bbox[1]))
ctx.channel_send(‘w’,int(bbox[2])-int(bbox[0]))
ctx.channel_send(‘h’,int(bbox[3])-int(bbox[1]))
ctx.channel_send(‘Frame_id’,frame_id)
ctx.channel_send(‘id_num’,id_num)

for index_channel,id_t in enumerate(id_channel):
if id_t == id_num:
ctx.channel_send(name_channel[index_channel],float(detections[i].confidence))


#2

Hi @Guilherme,

Thanks for your report. We will look closer at your problem after weekend. Is it possible to feed us with full source code of your experiment so our investigation will be easier?


#3

Sure, is the code below:

def postprocess(self,net_out, im,frame_id = 0,csv_file=None,csv=None,mask = None,encoder=None,tracker=None):
“”"
Takes net output, draw net_out, save to disk
“”"
boxes = self.findboxes(net_out)

#Variables to neptune
ctx = neptune.Context()
id_channel=[]
name_channel=[]

# meta
meta = self.meta
nms_max_overlap = 0.1
threshold = meta['thresh']
colors = meta['colors']
labels = meta['labels']
if type(im) is not np.ndarray:
	imgcv = cv2.imread(im)
else: imgcv = im
h, w, _ = imgcv.shape
thick = int((h + w) // 300)
resultsForJSON = []

if not self.FLAGS.track :
	for b in boxes:
		boxResults = self.process_box(b, h, w, threshold)
		if boxResults is None:
			continue
		left, right, top, bot, mess, max_indx, confidence = boxResults
		if self.FLAGS.json:
			resultsForJSON.append({"label": mess, "confidence": float('%.2f' % confidence), "topleft": {"x": left, "y": top}, "bottomright": {"x": right, "y": bot}})
			continue
		if self.FLAGS.display or self.FLAGS.saveVideo:
			cv2.rectangle(imgcv,(left, top), (right, bot),colors[max_indx], thick)
			cv2.putText(imgcv, mess, (left, top - 12),0, 1e-3 * h, colors[max_indx],thick//3)
else :
	if not ds :
		print("ERROR : deep sort or sort submodules not found for tracking please run :")
		print("\tgit submodule update --init --recursive")
		print("ENDING")
		exit(1)
	detections = []
	scores = []
	for b in boxes:
		boxResults = self.process_box(b, h, w, threshold)
		if boxResults is None:
			continue
		left, right, top, bot, mess, max_indx, confidence = boxResults
		if mess not in self.FLAGS.trackObj :
			continue
		if self.FLAGS.tracker == "deep_sort":
			detections.append(np.array([left,top,right-left,bot-top]).astype(np.float64))
			scores.append(confidence)
		elif self.FLAGS.tracker == "sort":
			detections.append(np.array([left,top,right,bot]).astype(np.float64))
	if len(detections) < 3  and self.FLAGS.BK_MOG:
		detections = detections + extract_boxes(self,mask)

	detections = np.array(detections)
	if detections.shape[0] == 0 :
		return imgcv
	if self.FLAGS.tracker == "deep_sort":
		scores = np.array(scores)
		features = encoder(imgcv, detections.copy())
		detections = [Detection(bbox, score, feature) for bbox,score, feature in zip(detections,scores, features)]
		# Run non-maxima suppression.
		boxes = np.array([d.tlwh for d in detections])
		scores = np.array([d.confidence for d in detections])
		indices = prep.non_max_suppression(boxes, nms_max_overlap, scores)
		detections = [detections[i] for i in indices]
		tracker.predict()
		tracker.update(detections)
		trackers = tracker.tracks
		i=0
	elif self.FLAGS.tracker == "sort":
		trackers = tracker.update(detections)
	for track in trackers:
		if self.FLAGS.tracker == "deep_sort":
			if not track.is_confirmed() or track.time_since_update > 1:
				continue
			bbox = track.to_tlbr()
			id_num = str(track.track_id)
			if id_num not in id_channel:
				id_channel.append(id_num)
				name_channel.append('person id %d' % int(id_num))
				#ctx.create_channel('person id %d' % int(id_num),neptune.ChannelType.NUMERIC)
		elif self.FLAGS.tracker == "sort":
			bbox = [int(track[0]),int(track[1]),int(track[2]),int(track[3])]
			id_num = str(int(track[4]))
		if self.FLAGS.csv:
			if len(trackers) == len(detections):
				csv.writerow([frame_id,id_num,int(bbox[0]),int(bbox[1]),int(bbox[2])-int(bbox[0]),int(bbox[3])-int(bbox[1]),detections[i].confidence])
				#print('Frame_id {} id_num {} x {} y {} w {} h {} Confidence {}'.format(frame_id,id_num,int(bbox[0]),int(bbox[1]),int(bbox[2])-int(bbox[0]),int(bbox[3])-int(bbox[1]),detections[i].confidence))
				#Comunicação neptune

				ctx.channel_send('x',int(bbox[0]))
				ctx.channel_send('y',int(bbox[1]))
				ctx.channel_send('w',int(bbox[2])-int(bbox[0]))
				ctx.channel_send('h',int(bbox[3])-int(bbox[1]))
				ctx.channel_send('Frame_id',frame_id)
				ctx.channel_send('id_num',id_num)

				for index_channel,id_t in enumerate(id_channel):
					if id_t == id_num:
						ctx.channel_send('%s' % name_channel[index_channel],float(detections[i].confidence))
				i=i+1
			csv_file.flush()
		if self.FLAGS.display or self.FLAGS.saveVideo:
			cv2.rectangle(imgcv, (int(bbox[0]), int(bbox[1])), (int(bbox[2]), int(bbox[3])),
					        (0,0,255), thick//1)
			cv2.putText(imgcv, id_num,(int(bbox[0]), int(bbox[1]) - 12),0, 1e-3 * h, (0,0,255),thick//3)
return imgcv

Blockquote

Blockquote


#4

Thank you @Guilherme ,

One more thing, could you provide us ID of your failed experiment?


#5

This is simple example which reproduce this error:

from deepsense import neptune

ctx = neptune.Context()
ctx.channel_send('x', 1)

ctx = neptune.Context()
ctx.channel_send('x', 1)

This will end up with error:
Failed to send value to 'x' channel in x=1.0. X-coordinates must be strictly increasing for channel: channel-id. Invalid point: Point(1.0,Y(Some(1.0),None,None,None))

In your code each time you send channel value you have differen neptune context variable (ctx).

To solve your problem please initialize ctx outside postprocess method and pass ctx to postprocess. Best place to initialize ctx is in main.py.

Second solution is to use singleton with ctx. Singletons are initialized once.