Python error: can't pickle SwigPyObject objects when using Multiprocessing and Tensorflow model

I am unable to use multiprocessing with a Tensorflow model. A SciKit-Learn model works fine.

I created a sliding window object detector. This detector scans an image, right to left, top to bottom and extracts sub-windows. Each sub-windows is assessed to see if it contains the learned object.

Features are extracted from the sub-windows. I'm modifying my code that uses a HOG feature extractor and replacing it with a trained VGG16 model with the top cut off. Prediction are made using a SVM. The sliding window method is slow but can be sped up considerably if the predictions are made in parallel. I was able to do this with an SciKit learn model (SVM) with no problem using multi-threading. However, when I add a Tensorflow model, I received the error message:

TypeError: can't pickle SwigPyObject objects

I created a class that takes in the model as a parameter. A minimal example is given below. It works when TF_model=[].

Here is a minimal example of the problem

from multiprocessing import Process,Queue,Pool,Manager   
class ObjectDetectorMinimal:
  def __init__(self, SKLearnModel, TF_model):
    # Note: in this minimal example, these models are not used
    self.SKLmodel = SKLearnModel 
    self.TFmodel  = TF_model

  def f1(self):  # Use multiple threads
    # Uses multithreading instead of multiprocessing.
    p = Pool()
    print("Starting the Parallel Processing across multiple threads")
    output1=[]
    output2=[]
    myArgs=[]
    xx = range(0,5)
    yy = range(20,25)
    for i in range(0,len(xx)-1):
        myArgs.append([xx[i],yy[i]])
    print("MyArgs: {}".format(myArgs))    

    print("Starting p.map()")
    pp=list(p.map(self.f2,myArgs))  # p.mat does not require a Queue to be defined.
    for ppp in pp:
            output1 = output1 + ppp[0]
            output2 = output2 + ppp[1]
    p.close()
    p.join()
    print("Finished f1()")
    return(output1,output2)

  def f2(self,myArgs):
    output1=[]
    output2 =[]
    xx=myArgs[0]
    yy=myArgs[1]

    #print("xx: {} yy {} ".format(xx,yy))
    b,p = self.f3(xx,yy)
    if len(b)>0: # Check for empty
        #print("b: {} p {}".format(b,p))
        output1 = output1 + b
        output2 = output2 + p
        return(output1,output2)
    else:
        print("b is empty")

  def f3(self,x,y):
    self.processID = os.getpid()
    output1=[]
    output2=[]
    output1.append([x ,2*x, 3*x])
    output2.append([y, 2*y, 3*y])
    return(output1,output2)

 SKLmodel = svm.SVC(gamma='scale')
 TF_model=VGG16(weights="imagenet", include_top=False)
 od = ObjectDetectorMinimal(SKLmodel,TF_model)
 #od = ObjectDetectorMinimal(model,[])
 output1,output2=od.f1()
 print("\nOutput1: {} \n \nOutput2: {}".format(output1,output2))

The output for od = ObjectDetectorMinimal(model,[]) is:

Starting the Parallel Processing across multiple threads
MyArgs: [[0, 20], [1, 21], [2, 22], [3, 23]]
Starting p.map()
Finished f1()

Output1: [[0, 0, 0], [1, 2, 3], [2, 4, 6], [3, 6, 9]] 

Output2: [[20, 40, 60], [21, 42, 63], [22, 44, 66], [23, 46, 69]]`

If I include the Tensorflow Model, I get:

Starting the Parallel Processing across multiple threads
MyArgs: [[0, 20], [1, 21], [2, 22], [3, 23]]
Starting p.map()

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-110-a2b46430a3c6> in <module>
      3 od = ObjectDetectorMinimal(model,featureextraction_model)
      4 #od = ObjectDetectorMinimal(model,[])
----> 5 output1,output2=od.f1()
      6 print("\nOutput1: {} \n \nOutput2: {}".format(output1,output2))

<ipython-input-106-d7922b5e2ae3> in f1(self)
     18 
     19         print("Starting p.map()")
---> 20         pp=list(p.map(self.f2,myArgs))  # p.mat does not require a Queue to be defined.
     21         for ppp in pp:
     22                 output1 = output1 + ppp[0]

/usr/lib/python3.5/multiprocessing/pool.py in map(self, func, iterable, chunksize)
    258         in a list that is returned.
    259         '''
--> 260         return self._map_async(func, iterable, mapstar, chunksize).get()
    261 
    262     def starmap(self, func, iterable, chunksize=None):

/usr/lib/python3.5/multiprocessing/pool.py in get(self, timeout)
    606             return self._value
    607         else:
--> 608             raise self._value
    609 
    610     def _set(self, i, obj):

/usr/lib/python3.5/multiprocessing/pool.py in _handle_tasks(taskqueue, put, outqueue, pool, cache)
    383                         break
    384                     try:
--> 385                         put(task)
    386                     except Exception as e:
    387                         job, ind = task[:2]

/usr/lib/python3.5/multiprocessing/connection.py in send(self, obj)
    204         self._check_closed()
    205         self._check_writable()
--> 206         self._send_bytes(ForkingPickler.dumps(obj))
    207 
    208     def recv_bytes(self, maxlength=None):

/usr/lib/python3.5/multiprocessing/reduction.py in dumps(cls, obj, protocol)
     48     def dumps(cls, obj, protocol=None):
     49         buf = io.BytesIO()
---> 50         cls(buf, protocol).dump(obj)
     51         return buf.getbuffer()
     52 

`TypeError: can't pickle SwigPyObject objects`

I expect to use the Tensorflow model in the same manner that I use the SciKit learn model when using the Multiprocessing module