Classification notebook - add something to Thumbs UP Thumbs Down

I think I can use the JupyterLab classification_interactive.ipyn as a basis for vision detecting a locking pin - in the back of a truck. I want to add pylogix - - which lets me send values to a PLC. I just can’t figure out where to add the code. I do a pip install pylogix - then all they pylogix PLC stuff works in the notebook.

Need to put something like this in the classification notebook.

import pylogix

from pylogix import PLC
with PLC() as comm:
comm.IPAddress = ‘10.49.107.10’
ret = comm.Write(‘JP_DINT’,1)

This would put a 1 in the JP_DINT tag for PLC 10.49.107.10 - – - say if it was ‘Thumb UP’ - – - Then I would also do a ret = comm.Write(‘JP_DINT’,0) for ‘Thumbs DOWN’

I’d want to not send 8,000 plc updates per second - – but I don’t want to discourage any suggestions because of that… I can start with the first part…

Thankyou

Hi @johnmpeterson,

It doesn’t seem to be cuDNN related issue. Could you please elaborate more specific to cuDNN issue that you are getting while working with pylogix PLC?

Thanks

Thanks for checking - - it was not cuDNN - It was more generic regarding adding code to the Deep Learning Institute image classification thumbs_up thumbs_down - - and I just got it working:
pip install pylogix

then in the code:
import pylogix
and in the Live Execution portion – add ‘from pylogix import PLC’ at the top, then replace def live with this:

def live(state_widget, model, camera, prediction_widget, score_widget):
global dataset
changeprediction = ‘blank’
lastprediction = ‘blank’
print(changeprediction)
while state_widget.value == ‘live’:
image = camera.value
preprocessed = preprocess(image)
output = model(preprocessed)
output = F.softmax(output, dim=1).detach().cpu().numpy().flatten()
category_index = output.argmax()
prediction_widget.value = dataset.categories[category_index]
lastprediction = dataset.categories[category_index]
if lastprediction != changeprediction:
changeprediction = lastprediction
if changeprediction == ‘thumbs_up’:
with PLC() as comm:
comm.IPAddress = ‘10.49.107.10’
comm.Write(‘JP_BOOL’,1)
else:
with PLC() as comm:
comm.IPAddress = ‘10.49.107.10’
comm.Write(‘JP_BOOL’,0)

    for i, score in enumerate(list(output)):
        score_widgets[i].value = score

now I can do image recognition - - AND send a value to a PLC tag!!!

Hi @johnmpeterson ,

Good to hear that you finally got it working. Please do let us know in case you have any query related to cuDNN or in other areas supported in forum:
https://forums.developer.nvidia.com/

Thanks