Wednesday, June 1, 2016


For a period in my youth I was about eight years old.

It was our tradition to have my grandfather over for Sunday dinner. One Sunday, after dinner we were sitting around the table discussing Weighty Subjects. My grandfather had been reading a book called "The Bible as History" (I believe the first edition by Werner Keller). Shortly, my father and grandfather began a deep discussion of something called a "virgin birth".

Now, I was eight years old and I knew about virgins. Someone had told me that a virgin was "a lady who is not married". Therefore, I was mightily confused. Of course you can have a baby without being married! What's the big deal? And, besides that, this Mary in the story had a husband.

I was squirming.  I sat there and listened to the discussion. These two men are not stupid. There is obviously some substance to this topic. Oh, how I struggled not to interrupt.

This was long before I heard of Mark Twain's adage: "Tis better to remain silent and be thought a fool than to say something and remove all doubt."

In this case, remaining silent led me to be viewed as "well mannered" and "respectful".

As soon a I could, I went to my room and got the dictionary. I discovered that I had been lied to.  Blatantly. I had been given certain background information that was just plain wrong, and had (almost) tried to apply it to a real-world situation.

I understood that adults lied to children to make a point, or to tell tales, or or to engender joy and amazement - like Santa Claus or the Easter Bunny. But this was a simple definition for a word used in the real world without any subtle nuances. And they lied to me about it for no good reason.

Ronald Regan famously said "Trust, but verify". I think that the Great Communicator was occasionally needlessly verbose and insufficiently reductionist.  I say: "Verify".


There are those who insist on finding a conflict between Science and Religion.

Consider: There is no mention of dinosaurs in the Bible. So, just exactly what is the Aramaic word for dinosaur, anyway? To presume divine revelation of the whole history of Creation also presumes that a human being can remember it and write it down. To claim that the Bible contains the entire revealed knowledge of Creation is the height of hubris.

A benevolent God will reveal knowledge as we are able to understand it.

The Bible discusses day and night. There is nothing about the earth moving. Obviously, it is the sun and stars that move. Are you blind? That is all you need to know for now.

But, as we get a little older we become better able to explore Creation. We discover wonders. We tease understanding from Nature around us.

There is no special place in God's eye for ancient shepherds.

Evolution is an expression of Divine Will. A benevolent God will not want His creatures to suffer. In order to "be fruitful and multiply", they must be able to adapt and be comfortable in new environments. This adaptability is called evolution and is a Wonder of Creation.

To say that a modern scientist who struggles to understand new subtleties of Creation is somehow irreverent or less holy than previous generations does a disservice to everyone and denies the true grandeur of Creation.

New Divine Revelation is always available for anyone who will look carefully at the world around them. How can new, deeper Wonders be less divine than ancient ones?

This is the purpose of Science: to discover truths of Creation.

Sunday, June 3, 2012

I Have A Cat

My cat is diabetic.  When he was diagnosed, the vet said that grocery-store pet food is almost certain to cause diabetes.  Let us examine the reasoning.
Dogs and cats evolved as carnivores, and as such have metabolisms adapted to a high-protein diet in support of a fairly active lifestyle.  When kept as pets they are granted access to essentially unlimited amounts of food that takes little or no effort to obtain.  And their activity is restricted by being confined indoors or in a small yard.

Protein is generally expensive, so pet food manufacturers tend to add fillers in the form of carbohydrates. This led my vet to refer to these products as 'diabetes in a bag'.

In order for the pet food manufacturer to stay in business, customers need to buy their products.  Therefore anything that might trigger a pet's natural finickiness is carefully suppressed.  And flavor enhancers, salt and other substances are added.  As far as the manufacturer is concerned, the pet must keep eating this brand at all costs.

It is also necessary for the pet owner to be satisfied with the apparent quality of the food. He expects nothing less than absolute consistency year after year.

It is also bad form for the pet food to have bugs in it. It used to be that finding the occasional weevil or beetle in a bag of dry pet food was more-or-less expected.
It has been years since I saw any bugs in the pet food.  And if I spill some on the floor in the garage?  Still no bugs.  Hmmmm. Could it be that there are insecticides in the pet food? No labeling requirements. Ignorance is bliss.

All of this actually works.  The life expectancy of a pet is perhaps twice as long as the same animal in the wild. In the wild, death is usually from exposure or predation.  Pets die of organ failure and tumors.  Overall, this is probably a good deal.

And pet food is readily available, reasonably priced, and generally safe in the short term.

* * *

To manage my cat's glucose levels, my vet recommended Purina Veterinary Diets DM Dietic Management Feline Formula cat food.  This stuff is cat food with less carbohydrate content.  It is also _prescription_ cat food.  It is just food with added things (that were not necessary in the first place) left out, but it is still _only_ available by prescription.

And it costs $5.00 per pound.  My cats eat better than I do.

* * *

My cat requires insulin injections.  He weighs fourteen pounds and only requires two units of insulin twice a day.  Feline insulin is only 40% as potent as human insulin because smaller quantities are needed and the dose needs to be a certain size to measure accurately with a syringe.

Therefore, syringes with different markings are used for 40U insulin than the ones used for 100U human insulin.  Naturally, these less-common 40U syringes are more expensive.

One can measure any desired _actual_ amount with either syringe.  You just have to be able to do the simple math to convert the proportions. Even mentioning the use of an alternate syringe to a Health Care Professional is likely to cause an apoplectic attack. There is "the right way to do it" and that is the only way to do it. Because that is what the instructor said in Doctoring 101, and because if you give any other answer on the Standardized Certification Exam you are likely to risk your license.

The Prozinc feline insulin is actually a suspension of human insulin and additives that are designed to make it more effective in the feline metabolism. It comes in bottles containing 400 units.  This means that one bottle will last me about 100 days.

In general, insulin will last up to 30 days without refrigeration, but much longer if kept properly chilled (never frozen).  OK. If I am careful, I can get full use out of the bottle.

The insulin suspension will separate fairly quickly when stored.  It is imperative that it be properly, gently mixed before withdrawing each dose. Even an occasional lapse here will result in an overdose or under-dose in the rest of the bottle that will mess things up badly over the course of the three-month life of the particular bottle.

The insulin bottle has a rubber stopper that is penetrated by the syringe to withdraw a dose. A syringe will be inserted and removed through this stopper 200 times. This is a lot of wear on the single stopper. Even if one is careful to keep the surface clean, over time there is no telling what foreign material gets pushed into the bottle along with the needle.

Each time a dose is removed a comparable quantity of air must be injected into the bottle. This is accomplished by pulling the syringe plunger back in the air, sticking the needle into the bottle, injecting all the air from the syringe into the bottle and then withdrawing the proper dose of insulin.

This process takes whatever is in the air (pollen, mold spores, dust, etc.) and injects it into a previously sterile media. And is repeated at measured intervals two hundred times.

Yet another reason to keep the bottle carefully refrigerated. And my fingers crossed.

* * *

I have alluded to several problems that could be solved if proper attention were given to the entire process.

1. Insulin is one of the simplest proteins and should be very easy to synthesize.

2. There should be a clean and easy way to measure the concentration of proteins in solution.

3. There should be a simple method of detecting foreign material in a solution.

4. There should be a realistic way of creating pet food to a specific recipe, in quantities and at a cost that makes small-scale, local production possible.

5. The regulatory environment that allows pet food to be available 'by prescription only' is another egregious example of abuse of intellectual property rights.

Saturday, September 24, 2011

On Inventory Management


Managing the availability of goods is key to the sustainable future of civilization.  Making better use of materials and resources, eliminating needless duplication, and improving reuse and recycling can improve the lives of individuals, families and communities.  This essay examines the flow and availability of goods from the standpoint of inventory management systems.  I give examples of current systems, look at an ideal goal, and propose steps that could lead to both immediate and long-term benefits.  

This essay is a work-in-progress and will be updated periodically.  Other  related essays concerning image processing and object recognition will be posted as they reach maturity.  


In my youth, my father had a machine shop and lab in the five-car garage area of our house.  We parked the cars in the driveway.  As I grew up, I spent much time exploring the boxes, bins, cabinets, shelves and assorted containers, learning about the objects within.  I learned to use the tools, built projects and conducted experiments.  As an inquisitive nine-year-old, I had examined almost every object and attempted to divine its use.  I read the Newark and Grainger catalogs while I fell asleep.  I had a strong vocabulary and could describe and name most any tool or part. 

In particular, I could accurately describe the location of almost any item in the shop.  Many items had multiple homes, as duplicates were encouraged and often grouped by project instead of into simple bins.  I could clean a work area and put tools, parts and equipment back in their normal places.  I could disassemble and reassemble things ranging from toys to lawnmower engines. 

I was, in effect, an inventory manager with skills superior to any "professional" system in existence today.

Let us examine the features and requirements of inventory management and suggest techniques that might bring the capabilities in the high-tech world up to the level of a small child.


Very simply, we must keep track of objects in time and space. 

We must have some general idea of what we mean by an "object", and ways of recognizing and remembering properties.  This implies a data entry system with a method of rapidly assigning properties to objects.  These properties may be descriptions from catalogs or data sheets, observed properties such as size or color, and arbitrary manually entered information. 

Tracking, in its simplest form involves only "Get this object from here and put it there" concepts.  Manual forms of data entry, and simple scanners might be sufficient as a first step.  An automated system would probably observe an area and recognize objects as they enter and leave. 

We should be able to answer questions like:
  • "Where is the nearest ...?"
  • "How many ... do we have?"
  • "How long have we had ...?"
  • "Where has ... been stored?"
  • "Is ... safe to handle?"
  • "Does ... need to be right side up?"
  • "What does ... attach to?"
  • "How does ... need to be stored?"
  • "Do we need to order more ... when this is used up?"
  • "Is ... more expensive than ...?"
  • "Is there anything special about ...?  Is it rare or valuable or dangerous or fragile?"
  • "What is ...?  What is it used for?"

The system must be so easy to use that it will be part of everyday life.  An assistant that can answer accurately when you wonder where you left the car keys.  A retail checkout system that does not need barcodes. 

The overall system must be tolerant of bad or conflicting data.  Over time everything should be generally self-correcting.

Do not necessarily require a "Parts in Bins" organization.  There may be preferred locations so that tools tend to wind up in tool boxes but it should not be carried to extremes.

The database should:
  • allow for object identification,
  • retain arbitrary properties,
  • track current location and location history,
  • group objects during storage or use,
  • allow for assembly and disassembly of composite objects
Visual Object Recognition

Current barcode scanners beep when they successfully scan an object.  As far as I am concerned, a proper scanner will only beep when it sees an object that it does NOT recognize.  I.e. we should eliminate the unnecessary confirmation noise.  Identification should be so accurate and so routine that the only thing that should need the user's attention is the true exceptions.  

A forthcoming essay will focus on the requirements of visual object recognition systems.

There is a range of requirements from the most basic detection of visual features within a background of clutter all the way through the comprehensive integration with a central object-location-tracking database.  This is required to ensure accurate identification of a particular object, not just the kind of object.  

Selecting the pencil laying on the notepad in front of you is almost always preferable to selecting an identical pencil from the pencil holder.  The history of the object is as important as its location, and, in general, history requires the combined recognition and tracking of multiple visual sensors.  

In a world of ubiquitous, distributed visual recognition systems such as foveal cameras, each camera develops a learned history of particular features that compose and are associated with particular objects.  The different histories ("experiences") of each camera means that their library of recognition templates will be unique.  And yet, we want to be able to assign the same "identity" to objects as they move from one camera's area to the next.  This implies that there should be an "object template description" that is both compact and sufficient to (more or less) uniquely identify a particular class of object. This data is what would normally be communicated with the central object-location database, and with other nearby cameras to aid in tracking particular objects from one station to the next.  

Consider: trying to locate a particular individual  using the cameras in a shopping mall.  Start with a general description such as "short, fat guy in a red suit".  This is actually a LOT of information expressed very succinctly.  It lops out most of the objects from your recognition database and allows attention to be devoted to the most likely suspects.  Maybe a candidate is seen from one point of view and you add to the description: "he has shiny black boots".  Motion tracking and adjacency ensures that this is the same individual.  You are building a more complete description.  Another view: "He has a white beard".  Multiple observers watching from different  cameras share the ability to casually recognize these high-level features and need ONLY the general location and compact description to be reasonably assured of success. 

Modern Examples

The inventory at a WalMart retail store is intended to be in near-constant motion.  Trucks with assorted merchandise arrive at the back doors.  Products are rapidly distributed to essentially arbitrary locations within the store for presentation to customers.  Customers roam the store selecting desired items.  Items thus selected are scanned, purchased and removed through the front doors.  Approximate item-counts are maintained by using a "delivered minus sold" algorithm, but this becomes so inaccurate over time that periodic physical inventories and complete overall reorganizations of the store are necessary. 

If I visit a hardware store I usually expect to be able to find a knowledgeable employee and say something like "I need a bigger one of these", or "This wore out and pieces broke off.  Do you have any more?", or "I need to mount this on a brick wall.  What do I use to do it?"  The employee is expected to be able to recognize my object and its use, match it against items in his experience using arbitrary criteria, and give me a meaningful response within a few seconds. 

Typical large companies manage warehouses and stock rooms with bins, shelves, cabinets, etc. and try to ensure that all like objects are collected in one place.  This facilitates locating desired items, counting stock, providing an appropriate storage environment and ensuring that replacements are ordered in a timely manner.  Frequently in-house part numbers are created and assigned to the storage locations to help with this process.  Unfortunately, there is often a many-to-many relationship which allows many different vendors to supply the product that winds up in a particular bin, and the same exact product may need to be stored in different locations due to convenience or necessity.  The computerized inventory system most likely attempts to enforce an idealized "one part number, one location, one quantity" paradigm.  More advanced or customized systems tend to be increasingly unwieldy due to special cases and exceptions and the need for more operator training. 

My wife appears to have a diametrically opposite approach.  I have often observed an apparent equal probability that a particular item will be in any of the boxes, bins, shelves, cabinets, closets, and drawers in the house.  This is actually not an outlandish situation if you have a good memory and are able to accurately and rapidly communicate enquiries and responses: "Where's the glue?" "Elmer's is in the bin under the bed.  Contact cement is on the top shelf of the linen closet."

On the International Space Station inventory items tend to be stored in bags within bags.  In the micro-gravity environment there is generally no need for rigid containers.  Objects can be stored compactly in collapsible bags, packed into storage spaces, and gently secured against air currents and slight accelerations using bungee cords.  Inventory access problems usually revolve around trying to figure out "which bag?", "where?", and "how do I get to it?".  This frequently involves lengthy conversations with the ground controllers who are responsible for trying to record ongoing activity and look up records from past operations. 

Homer Simpson has a garage full of lawn and garden equipment.  It is all labeled "Property of Ned Flanders".  The traditional view of this satire is that Homer is a thief who never returns items that he borrows.  I, however, would contend that Ned has simply found a way to store his excess inventory in Homer's garage.

Other Recognition Techniques

In these essays, I focus on visual recognition systems.  As a child, I was not so limited.  We had recently moved, so much of the material in the garage was packed in various boxes.  One day I was going through a box of vacuum tubes -- ancient electronic components that are kind of like fist-sized, glass transistors.  All of these tubes were wrapped in newspaper packing material.  As I picked up one of the wrapped objects, I knew immediately that it was not a tube.  It was a bottle containing about a half-pound of mercury.  In fact, I knew that it was mercury before I unwrapped it.  And I had no prior knowledge that we even had a container of mercury. 

This is an example of what I consider a proper an object recognition system in operation.  The object was manipulated by a sensitive tactile handling system.  The manipulation system safely transitioned from working with glass containers of vacuum to glass containers of mercury.  The feedback from the system instantly provided object-density estimates.  Movements allowed me to detect that the object was not only NOT solid, but that the contents were fluid.  Silence during the manipulation allowed me to deduce that this was not a jar of washers or nuts.  The fact that, during rotation, the center of mass did not shift as one would expect with a granular fluid also helped narrow the identification. 

The tentative identification became clearer as the bottle was unwrapped.  During this short time the entire system changed.  Dropping a newspaper-wrapped vacuum tube is a non-event.  Dropping a bottle of mercury is a whole different matter.  Even in the days before California-inspired paranoia concerning heavy metals, a child could be concerned about making a Big Mess.  My casual attitude became much more focused.  My grip became firmer.  My posture became more stable.  In short, the discovery led me from idle curiosity to attentive excitement in just a few seconds.  All without a single visual cue. 


In light of this background, I contend that inventory management should be an automated, continuous, interactive process.  By "interactive" I mean that the inventory management system should physically interact with the items that it is managing, much as I did as a child, or as the hardware store employee does to become good at his job. 

This would allow the updating of inventory data to be treated as a routine maintenance operation instead of an inefficient, disruptive quarterly or annual event.  Managing objects in boxes (or boxes of objects) is only sufficient if there is a complete prior understanding of the actual, individual objects.  


Although I am describing this as Inventory Management, there are many applications.  The Inventory that we are managing need not be simply nuts and bolts.  For example:
  • Identify people and track their movement
  • Production operations in a manufacturing facility.  Time and Motion studies.
  • Ensuring "Appropriate Redundancy" of tools and supplies.  Not too many and not too few.
  • Transportation, Cargo and Freight operations.
  • Restaurants, Food Services and other Just-In-Time manufacturing
  • Produce tracking for food safety
  • Infrastructure Maintenance - Buildings and Utilities
  • Construction Industry - On-site Manufacturing and assembly
  • Health Care and Pharmaceuticals
  • Records Management - Customers, Patients, ISO 9000, etc.
  • Libraries and Collections 
And maybe we turn the whole thing around.  Make a geolocation system by mounting the cameras on some of the objects and use them to watch the surroundings.  No more reliance on a fixed infrastructure. Recognition of objects and places are just two sides of the same coin, going into the same database.  


Keep track of items in time and space.
Object identification - data entry, description, photo(s), size, mass, etc.
Object tracking - manual / automated
Object status -
            storage in bag, box, etc.; conditions (temperature, etc.)
            usage - quantity is partially used (count in / count out) liquids, aerosols, etc.
            assembly - object becomes part of something else
            disposal / recycling / disassembly - including damaged or incomplete items
            movement - new object / new location
Object query -
            find nearest
            find totals
            find expired (drugs, milk, etc.)
            find history - objects / locations
Must be so easy to use that it is ALWAYS used for Get and Store operations
Bill of Materials - Object associations or groupings
Nesting - recursive objects within objects
Inventory - continuous update / verification of object info when any storage location is accessed
            best if automated
            Important to detect unexpected objects
            Automated recognition.
Database -
            Object identification
            Object history
Photographic recognition
            Introduction process - controlled observation and examination
                        Multiple views and lighting
                        Unique feature extraction
                        Associate with similar objects
                        Establish photographic scale and allow scale invariance
                        Record markings or other identification features
            Do not require arbitrary categorization. 
                        Let the recognition engine make its own categories or groups.
            Do not expect perfect identification
                        "Narrowing it down" should be good enough
                        Combine with location history to complete the identification
Do not necessarily require "Parts in Bins".  Items can be anywhere.
            Preferred storage locations may help ensure (toolboxes, etc.) are properly stocked
Locations <--> Parts should be a Many-to-Many relationship
Tolerant of bad / conflicting data.  Generally self-correcting.
            Hardware store
            Borrow a cup of Sugar
            Ned Flanders
            Tracking Santa Claus
Maintain orientation.  Don't spill it.
Disassembly -
            What is in it.  Hazardous?
            What is this part of?
            Survival inventory.  Motors contain coils of wire...
Expiration dates.  Use oldest first vs. Use freshest first.  Frozen bread anecdote.

Object history and current status.  A maid that always moves the dishes from the table to the dishwasher and THEN to the cabinet. 

Automated explorer manipulates objects to conduct inventory and cataloging.  Dangers include hazardous chemicals, high voltages, heavy/unstable objects, sharp tools, firearms, fragile objects, falls from high places, rotating machinery, buttons, switches and knobs, insects and pets.

Current systems and limitations
            Hospitality industry
                        Large number of identically furnished rooms
                        Maid service touches every object daily
                        Common maintenance, purchasing and disposal operations.
            Apartments, Condos and Tract homes
                        Many redundant objects
                        Progressively less commonality
                        Seasonal storage

The maid knows:
            Clean the nightstand
            Leave the lamp
            Wash the dishes
            Do not wash the paperback book

No communication regarding object location or availability
          You have to ask for it before the system will tell you anything
          System should be proactive and push appropriate information to to in advance of need

            Arbitrary descriptions are a problem
            Locations are hidden until a query is made